public ActionResult Login(LoginViewModel credentials)
        {
            if (ModelState.IsValid)
            {
               if(!_authManager.Login(credentials.Username, credentials.Password))
               {
                   // this model validation error is a model-wide validation error
                   // because string.empty is the key

                   ModelState.AddModelError(string.Empty, "wrong password or username");
                   return View(credentials);
               }
               else
               {
                   return RedirectToAction("Index","Home");
               }
            }

            return View();
        }
 public ActionResult Login(LoginViewModel login, String returnUrl)
 {
     if (ModelState.IsValid)
     {
         if (userRepository.ValidCredentials(login.UserName, FormsAuthentication.HashPasswordForStoringInConfigFile(login.Password, "md5")))
         {
             FormsService.SignIn(login.UserName, login.RememberMe);
             if (!String.IsNullOrEmpty(returnUrl))
             {
                 return Redirect(returnUrl);
             }
             return RedirectToAction("Index", "Home");
         }
         else
         {
             ModelState.AddModelError("", "The user name or password provided is incorrect.");
         }
     }
     return View(login);
 }