public ActionResult Validate(Login login) { Login credentials; if (!string.IsNullOrEmpty(login.Identification) && !string.IsNullOrEmpty(login.Password)) { credentials = bus.GetCredentials(login).FirstOrDefault(); if (credentials != null) { FormsAuthentication.SetAuthCookie(credentials.Identification, true); return(RedirectToAction("Index", "Home")); } else { return(RedirectToAction("Index", new { message = "User not exist." })); } } else { return(RedirectToAction("Index", new { message = "Credential is empty." })); } }