Пример #1
0
 public ActionResult Login(LoginModel loginModel)
 {
     if (ModelState.IsValid)
     {
         bool userValidation = Membership.ValidateUser(loginModel.UserName, loginModel.Password);
         if (userValidation)
         {
             UserService userService = new UserService();
             Guid userId = userService.GetUserId(loginModel.UserName);
             Session["AdminSession"] = userId;
             return RedirectToAction("Medical", "Medical");
         }
         else
         {
             loginModel.CustomErrorMsg = "Either username or password does not match.";
             return View("Login", loginModel);
         }
     }
     else
     {
         return View(loginModel);
     }
 }
Пример #2
0
 public ActionResult UnlockUser(string userName)
 {
     UserService userService = new UserService();
     userService.UnlockUser(userName);
     return View("Login");
 }