public ActionResult Signup(Users model) { using (context = new CustomFormAuthenticationEntities()) { context.Users.Add(model); context.SaveChanges(); } return(RedirectToAction("Login")); }
public ActionResult Login(UserModel model) { using (context = new CustomFormAuthenticationEntities()) { bool IsValidUser = context.Users.Any(user => user.UserName.ToLower() == model.UserName.ToLower() && user.UserPassword == model.UserPassword); if (IsValidUser) { FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction("Index", "Employees")); } ModelState.AddModelError("", "invalid Username or Password"); return(View()); } }