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