Producenta
Producenta

Reputation: 649

What is the right way to show different picture depending on user

I'm making my first asp.net mvc application Forum system. I want before every thread to show picture that shows is there new post or not. Like other forums, if there is something new from last login to show one picture and if there is nothing new show other picture. I am using asp.net identity 2.0.

I am thinking to make partial view and to invoke it where I need it. But how to show picture, depending on every user, I was thinking when user log in to be invoked method that checks every thread if there is something new after last login. Where to put this logic in the mvc project, or in the db project and to store for every user last login date, and to call this method. What is the right way?

Upvotes: 0

Views: 54

Answers (1)

Ewan
Ewan

Reputation: 1310

I suggest you do this in javascript as you will want the page response to be the same for all users so you can cache it etc

on each thread in your forum add a property of last updated

<div data-lastupdate="put the date there">

in the javascript set a variable for the date of the previous last login for the user

userlastlogin = date

then using jQuery (or whatever) set the picture on all forum divs where the lastupdate is greater than the last login date

Upvotes: 1

Related Questions