public ActionResult Login(LoginViewModel model, string returnUrl) { if (ModelState.IsValid) { if (authProvider.Autherticated(model.UserName, model.Password)) { return(Redirect(returnUrl ?? Url.Action("Index", "Admin"))); } else { ModelState.AddModelError("", "Incorrect username or password"); return(View()); } } else { return(View()); } }