public ActionResult Create(Account account) { if (ModelState.IsValid) { db.Accounts.Add(account); db.SaveChanges(); return RedirectToAction("Index"); } return View(account); }
public ActionResult ForgotPass(Account acc) { var list = db.Accounts.Where(a => a.UserName == acc.UserName).ToList(); if(list.Count > 0) { if (list[0].Mail == acc.Mail) { } } ViewBag.Message = "Password sent your email!"; return View(); }
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(); }
public ActionResult Edit(Account account) { if (ModelState.IsValid) { db.Entry(account).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(account); }