public ActionResult Reg(usersModel u1) { string s1 = Request["mail"].Replace("@gmail.com", ""); usersModel u = new usersModel() { users_id = s1, users_pass = Request["pass"], name = Request["user"], phone_no = "", addresss = "" }; if (Request["user"] == "" || Request["pass"] == "" || Request["password"] == "" || Request["mail"] == "") { ModelState.AddModelError(String.Empty, "ANy of the faield cant be empty"); } if (usersrep.chkUser(s1) == true && Request["mail"] != "") { ModelState.AddModelError(String.Empty, "Email is taken or null"); } if (Request["pass"] != Request["password"]) { ModelState.AddModelError(String.Empty, "password doesn't match"); } if (Request["pass"] != Request["password"] || usersrep.chkUser(s1) == true || Request["user"] == "" || Request["pass"] == "" || Request["password"] == "" || Request["mail"] == "") { return(View()); } if (ModelState.IsValid) { usersrep.addusers(u); } return(Redirect("Index")); }
public ActionResult Reg(usersModel u1) { usersModel u = new usersModel() { users_id = Request["mail"], users_pass = Request["pass"], name = Request["user"], phone_no = "", addresss = "" }; if (Request["user"] == "" || Request["pass"] == "" || Request["user"] == "" || Request["password"] == "") { ModelState.AddModelError(String.Empty, "Any of the fields can not be empty"); } if (usersrep.chkUser(Request["mail"]) == true && Request["mail"] != "") { ModelState.AddModelError("users_id", "Email is taken"); } if (Request["pass"] != Request["password"]) { ModelState.AddModelError("users_pass", "password doesn't match"); } if (Request["pass"] != Request["password"] || usersrep.chkUser(Request["mail"]) == true) { return(View()); } if (ModelState.IsValid) { usersrep.addusers(u); } return(Redirect("Index")); }