public async Task<ActionResult> Login(LoginModel model, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         var user = await UserManager.FindAsync(model.Email, model.Password);
         if (user != null)
         {
             if (user.EmailConfirmed == true)
             {
              
                 await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                 return RedirectToAction("Index");
             }
             else
             {
                 ModelState.AddModelError("", "Не подтвержден email.");
             }
         }
         else
         {
             ModelState.AddModelError("", "Неверный логин или пароль");
         }              
     }
     return View(model);
 }
 public async Task<ActionResult> Login(LoginModel model, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         ApplicationUser user = await UserManager.FindAsync(model.Email, model.Password);
         if (user == null)
         {
             ModelState.AddModelError("", "Неверный логин или пароль.");
         }
         else
         {
             user.EmailConfirmed = true;
             ClaimsIdentity claim = await UserManager.CreateIdentityAsync(user,
                                     DefaultAuthenticationTypes.ApplicationCookie);
             AuthenticationManager.SignOut();
             AuthenticationManager.SignIn(new AuthenticationProperties
             {
                 IsPersistent = true
                 
             }, claim);
             if (string.IsNullOrEmpty(returnUrl))
                 return RedirectToAction("Index", "AddDoctors");
             return Redirect(returnUrl);
         }
     }
     ViewBag.returnUrl = returnUrl;
     return View(model);
 }