public async Task <IActionResult> Register(User user) { if (ModelState.IsValid) { bool created = await _context.RegisterUser(user); if (created) { SaveUserToCookies(user); return(RedirectHome()); } ModelState.AddModelError( "Login", "User with this login already exists." ); } return(View(user)); }