public IActionResult AllUsers() { if (HttpContext.Session.GetString("AdminID") != null) { List <UserDetail> userList = new List <UserDetail>(); UserMethod um = new UserMethod(); string error = ""; userList = um.SelectUsers(out error); ViewBag.error = error; return(View(userList)); } else { return(RedirectToAction("AdminLogin")); } }