public bool IsEmailExist(String emailID) { ProjetScrumEntities db = new ProjetScrumEntities(); var v = db.Users.Where(a => a.Email == emailID).FirstOrDefault(); return(v != null); }
public ActionResult Inscription(User user) { if (ModelState.IsValid) { var isExist = IsEmailExist(user.Email); if (isExist) { ModelState.AddModelError("EmailExist", "Email already Exist"); return(View(user)); } ProjetScrumEntities db = new ProjetScrumEntities(); user.SignUpDate = DateTime.Now.ToLongDateString(); user.LastSignIn = DateTime.Now; user.DateOfBirth = DateTime.Now; user.Role_Id = 1; db.Users.Add(user); db.SaveChanges(); return(RedirectToAction("Login")); } else { return(View(user)); } }
public ActionResult Login(UserLogin user) { if (ViewBag.message == null) { ViewBag.message = ""; } else { } ProjetScrumEntities db = new ProjetScrumEntities(); // db.Database.SqlQuery("select * from ProjetUser ",); var c = db.Users.Where(a => a.Email == user.Email).FirstOrDefault(); if (c != null) { if (c.MotPasse == user.MotPasse) { Session["user"] = c; return(RedirectToAction("Index")); } else { ViewBag.message = "Invalid PassWord"; return(View()); } } else { ViewBag.message = "Invalid Login"; return(View()); } }
public ActionResult Login(UserLogin user) { ViewBag.message = ""; ProjetScrumEntities db = new ProjetScrumEntities(); var c = db.Users.Where(a => a.Email == user.Email).FirstOrDefault(); if (c != null) { return(RedirectToAction("Session")); } else { ViewBag.message = "Invalid Login and mot de pass"; return(View()); } }