// GET: User public ActionResult Index() { UserDBHandle dbhandle = new UserDBHandle(); ModelState.Clear(); return(View(dbhandle.GetLogins())); }
public ActionResult Edit(int id, Employee login) { try { //login.ID = id; UserDBHandle db = new UserDBHandle(); db.UpdateDetails(login); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id) { try { UserDBHandle db = new UserDBHandle(); if (db.DeleteUser(id)) { ViewBag.AlertMsg = "User Deleted Successfully"; } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(Employee login) { try { if (ModelState.IsValid) { UserDBHandle db = new UserDBHandle(); if (db.AddUser(login)) { ViewBag.Message = "User Details Added Successfully"; ModelState.Clear(); } } return(View()); } catch { return(View()); } }
public ActionResult Autherize(Project.Models.Login login) { UserDBHandle dbb = new UserDBHandle(); using (OOSEPROJECTEntities db = new OOSEPROJECTEntities()) { var user = db.Logins.Where(x => x.UserName == login.UserName && x.UserPassword == login.UserPassword).FirstOrDefault(); var userDetails = dbb.GetLogins().Find(smodel => smodel.ID == user.UserID); if (user == null) { login.LoginErrorMessage = "Wrong Username or Password"; return(View("Index", login)); } else if (userDetails.UserType == "admin") { Session["userID"] = user.UserID; Session["userName"] = user.UserName; Session["userType"] = userDetails.UserType; return(RedirectToAction("Index", "Home")); } else if (userDetails.UserType == "customer") { Session["userID"] = user.UserID; Session["userName"] = user.UserName; Session["userType"] = userDetails.UserType; return(RedirectToAction("IndexC", "Home")); } else if (userDetails.UserType == "employee") { Session["userID"] = user.UserID; Session["userName"] = user.UserName; Session["userType"] = userDetails.UserType; return(RedirectToAction("IndexE", "Home")); } else { login.LoginErrorMessage = "Enter valid type!"; return(View("Index", login)); } } }
public ActionResult Edit(int id) { UserDBHandle db = new UserDBHandle(); return(View(db.GetLogins().Find(smodel => smodel.ID == id))); }