public async Task <ActionResult> Login(LoginViewModel model) { if (ModelState.IsValid) { ClientProfileDto userDto = new ClientProfileDto { Email = model.Email, Password = model.Password }; ClaimsIdentity claim = await clientSevice.Authenticate(userDto); if (claim == null) { ModelState.AddModelError("", "Неверный логин или пароль"); } else { AuthenticationManager.SignOut(); AuthenticationManager.SignIn(new AuthenticationProperties { IsPersistent = true }, claim); return(RedirectToAction("Index", "Home")); } } return(View(model)); }