public ActionResult Login(PinLoginModel model) { try { if (model != null && model.Pin != null) { // verifyPin var nurse = Portal.Instance().VerifyPin(model.Pin); if (nurse == null) return RedirectToAction("Index", "Home"); nurse.TabletId = model.TabletId; nurse = Portal.Instance().UpdateNurse(nurse); Session["NurseID"] = nurse.Id; Session["NurseTablet"] = model.TabletId; return RedirectToAction("Index", "Patients"); //View(); } return RedirectToAction("Index", "Home"); } catch (Exception e) { return null; } }
public IActionResult Login() { if (User.Identity.IsAuthenticated) { return(RedirectToAction("Overview", "Table")); } PinLoginModel model = new PinLoginModel(); return(View(model)); }
public async Task <IActionResult> Login(PinLoginModel model) { if (ModelState.IsValid) { ActionMessage response = await authService.SignInAsync(model); return(RedirectToAction("ActionMessage", "Message", response)); } return(View(model)); }
public async Task <IActionResult> Login(PinLoginModel model) { if (ModelState.IsValid) { ApplicationUser user = userManager.Users.FirstOrDefault(x => x.UserPin.Equals(model.Pin)); await signInManager.SignInAsync(user, false); return(RedirectToAction("Overview", "Table")); } return(View(model)); }
public async Task <ActionMessage> SignInAsync(PinLoginModel model) { ActionMessage response = new ActionMessage(); ApplicationUser user = userManager.Users.FirstOrDefault(x => x.UserPin.Equals(model.UserPin)); if (user != null) { await signInManager.SignInAsync(user, false); response.Message = "Login Successful"; } else { response.Error = "Login Failed"; } return(response); }