public ActionResult Signup(User model) { using (var context = new OfficeEntities1()) { context.User.Add(model); context.SaveChanges(); } return(RedirectToAction("Login")); }
public ActionResult Login(Models.Membership model) { using (var context = new OfficeEntities1()) { bool isValid = context.User.Any(x => x.Username == model.Username && x.Password == model.Password); if (isValid) { FormsAuthentication.SetAuthCookie(model.Username, false); return(RedirectToAction("Index", "Employees")); } ModelState.AddModelError("", "Invalid Username and Password"); return(View()); } }