public async Task <IActionResult> Login(LoginViewModel model, string returnUrl = null) { if (!ModelState.IsValid) { return(View(model)); } LoginActionObject loginActionObj = _accountActions.Login(model.UserName, model.Password); if (loginActionObj.UserExists) { if (model.RememberMe) { await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, loginActionObj.ClaimsObject, new AuthenticationProperties { IsPersistent = true }); } else { await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, loginActionObj.ClaimsObject, new AuthenticationProperties { IsPersistent = false }); } return(RedirectToAction("Index", "Order")); } ViewBag.errorMessage = "User name or password wrong. Please try again. *"; return(View()); }