public ActionResult Signup(UserDetail model) { using (var context = new ProductmanagmentDBEntities()) { context.UserDetails.Add(model); log.Info("User:"******" Signin at " + DateTime.Now.ToString()); context.SaveChanges(); } return(RedirectToAction("login")); }
public ActionResult Login(Models.UserDetail model) { using (var context = new ProductmanagmentDBEntities()) { bool isValid = context.UserDetails.Any(x => x.EmailID == model.EmailID && x.Password == model.Password); if (isValid) { Session["UserID"] = model.UserID.ToString(); FormsAuthentication.SetAuthCookie(model.EmailID, true); log.Info("User:"******" Login at " + DateTime.Now.ToString()); return(RedirectToAction("Welcome", "ProductDetailsMVC")); } ModelState.AddModelError("", "Invalid Username and Password"); return(View()); } }