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();
- }
- }
any help or improvement please
i ll apriciate any help.

Thabo HappyPosted Oct 11, 2018, 9:56 AM
Ruchi SharavatPosted Oct 11, 2018, 6:40 AM
Thabo HappyPosted Oct 11, 2018, 6:36 AM
Ruchi SharavatPosted Oct 11, 2018, 1:57 AM
Farhan AhmedPosted Oct 10, 2018, 7:57 PM