TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Thabo Happy
NA
105
15.8k
asp.net mvc 5 count registered users and return the number
Oct 10 2018 4:21 PM
Hello am trying to count registered users from my database
so i came up with something like this:
public
class
HomeController : Controller
{
private
ApplicationDbContext db =
new
ApplicationDbContext();
public
ActionResult Index()
{
if
(User.IsInRole(
"Tutor"
))
{
ViewData[
"TutorCount"
] = db.Users.Count();
}
else
{
ViewData[
"StudentCount"
] = db.Users.Count();
}
return
View();
}
}
but doesn't seem to be working
any help or improvement please
i ll apriciate any help.
Reply
Answers (
5
)
wcf Service has zero application(noninfrastructure) endpoint
A Potentially dangerous Request.Cookies value was detected