public async Task <ActionResult> DoLogin(SystemUserLoginVM systemUserView) { var result = await _systemUserRepository.ValidateUserAndPassword(systemUserView); if (result.IsSuccess) { var claims = new List <Claim> { new Claim(ClaimTypes.Name, result.Value.FullName), new Claim(ClaimTypes.NameIdentifier, result.Value.Id) }; var userIdentity = new ClaimsIdentity(claims, "login"); ClaimsPrincipal principal = new ClaimsPrincipal(userIdentity); await HttpContext.SignInAsync(principal, new AuthenticationProperties { IsPersistent = true, IssuedUtc = DateTime.Now, ExpiresUtc = DateTime.Now.AddMinutes(15), AllowRefresh = true }); return(RedirectToAction("Index", "Dashboard", null)); } else { ModelState.AddModelError(string.Empty, result.Error); return(View("Index", null)); } }