public ActionResult Signup(User model) { using (ZEROEntities context = new ZEROEntities()) { context.Users.Add(model); context.SaveChanges(); } return(RedirectToAction("Login")); }
public ActionResult Login(User model) { using (ZEROEntities context = new ZEROEntities()) { bool isValidUser = context.Users.Any(fl => fl.UserName.ToLower() == model.UserName.ToLower() && fl.UserPassword == model.UserPassword); if (isValidUser) { FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction("Index", "Employees")); } ModelState.AddModelError("", "Invalid Username & Password"); return(View()); } }