public async Task <ActionResult> Login(LoginModel model) { // await SetInitialDataAsync(); if (ModelState.IsValid) { UserDTO userDto = new UserDTO { Email = model.Email, Password = model.Password }; ClaimsIdentity claim = await VideoService.Authenticate(userDto); if (claim == null) { ModelState.AddModelError("", "Неверный логин или пароль."); } else { AuthenticationManager.SignOut(); AuthenticationManager.SignIn(new AuthenticationProperties { IsPersistent = true }, claim); int?par = 1; return(RedirectToAction("Index", "Video", par)); } } return(View(model)); }