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