public async Task <IActionResult> Index(LoginVIewModel _user, string returnUrl) { var usr = await _authenticate.Auth(_user); if (usr.sign.Succeeded) { var claims = new List <Claim>(); claims.Add(new Claim(ClaimTypes.Name, usr.ID)); claims.Add(new Claim(ClaimTypes.Surname, usr.name)); claims.Add(new Claim(ClaimTypes.Role, usr.role)); var identity = new ClaimsIdentity( claims, CookieAuthenticationDefaults. AuthenticationScheme); var principal = new ClaimsPrincipal(identity); var props = new AuthenticationProperties(); props.IsPersistent = _user.RememberMe; HttpContext.SignInAsync( CookieAuthenticationDefaults. AuthenticationScheme, principal, props).Wait(); return(RedirectToAction("", "Home")); } else if (usr.sign.IsLockedOut) { ViewBag.err = "User Locked Out for Multiple Wrong Attempts"; return(View()); } else { ViewBag.err = "User Name / Password Error"; return(View()); } }