public ActionResult register(User user) { if (ModelState.IsValid) { tblUSer reg = new tblUSer(); reg.emailid = user.emailid; reg.Name = user.name; reg.pass = user.password; reg.usertype = "Client"; lsd.LsLib.tblUSers.Add(reg); lsd.LsLib.SaveChanges(); } return(View()); }
public ActionResult Login(login log) { tblUSer tbl = lsd.LsLib.tblUSers.Where(x => x.emailid.Equals(log.emailid) && x.pass.Equals(log.password)).FirstOrDefault(); if (tbl != null) { if (tbl.usertype.Equals("Admin")) { Session["username"] = tbl.Name; FormsAuthentication.SetAuthCookie(tbl.Name, false); return(RedirectToAction("Index", "Admin/AdminHome")); } if (tbl.usertype.Equals("Client")) { Session["username"] = tbl.Name; FormsAuthentication.SetAuthCookie(tbl.Name, false); return(RedirectToAction("Index", "Customer/CustomerHome")); } } return(View()); }