public ActionResult Login(Account account)
{
if (ModelState.IsValid)
{
List<Account> l = db.Accounts.Where(a => a.UserName == account.UserName).ToList();
if (l.Count > 0)
{
if (l[0].Password == account.Password)
{
FormsAuthentication.SetAuthCookie(account.UserName, true);
return RedirectToAction("Index", "Home");
}
}
}
ModelState.AddModelError("", "Invalid username or password!");
return View();
}