// GET: Staff public ActionResult Index() { if ((HttpContext.Session.GetString("Role") == null) || (HttpContext.Session.GetString("Role") != "Admin")) { return(RedirectToAction("Index", "Home")); } List <Staff> staffList = staffContext.GetAllStaff(); return(View(staffList)); }
// GET: Staff public ActionResult Index() { // Stop accessing the action if not logged in // or account not in the "Staff" role if ((HttpContext.Session.GetString("Role") == null) || (HttpContext.Session.GetString("Role") != "Staff")) { return(RedirectToAction("Index", "Home")); } List <Staff> staffList = staffContext.GetAllStaff(); return(View(staffList)); }
public ActionResult DeleteStaff(int IntStaffID) { Staff remStaff = new Staff { IntStaffID = IntStaffID }; bool success = StaffDAL.DeleteStaff(remStaff); StaffVM model = new StaffVM() { LstStaff = StaffDAL.GetAllStaff(), LstAllMembers = MembersDAL.GetAllMembers(), LstAllShows = ShowsDAL.GetAllShows() }; return(PartialView("CRUDPartials/_Staff", model)); }
public ActionResult Login(IFormCollection formData) { List <Customer> customerList = customerDetails.GetAllCustomers(); List <Staff> staffList = staffDetails.GetAllStaff(); string loginId = formData["txtLoginID"].ToString().ToLower(); string password = formData["txtPassword"].ToString(); foreach (Customer c in customerList) { if (c.EmailAddr.ToLower() == loginId && c.Password == password) { HttpContext.Session.SetString("Role", "Customer"); HttpContext.Session.SetString("Name", c.Name); HttpContext.Session.SetInt32("ID", c.CustomerID); return(RedirectToAction("CustMain", "Customer")); } } foreach (Staff s in staffList) { if (s.EmailAddr == loginId && s.Password == password && s.Vocation == "Administrator") { HttpContext.Session.SetString("Role", "Admin"); TempData["adminName"] = s.StaffName; return(RedirectToAction("Index", "Admin")); } else if (s.EmailAddr == loginId && s.Password == password && s.Vocation == "Pilot") { HttpContext.Session.SetString("Role", "Pilot"); TempData["adminName"] = s.StaffName; return(RedirectToAction("Index", "Admin")); } else if (s.EmailAddr == loginId && s.Password == password && s.Vocation == "Flight Attendant") { HttpContext.Session.SetString("Role", "Flight Attendant"); TempData["adminName"] = s.StaffName; return(RedirectToAction("Index", "Admin")); } } TempData["Message"] = "Invalid Login credentials"; return(RedirectToAction("Login")); }
public ActionResult Crud() { ViewBag.Message = "Create, Read, Update, and Delete table info here"; CRUDVM model = new CRUDVM(); IEnumerable <Cast> allCasts = CastsDAL.GetAllCasts(); IEnumerable <Club> allClubs = ClubsDAL.GetAllClubs(); IEnumerable <Date> allDates = DatesDAL.GetAllDates(); IEnumerable <Exec> allExec = ExecDAL.GetAllExec(); IEnumerable <Member> allMembers = MembersDAL.GetAllMembers(); IEnumerable <Pit> allPits = PitsDAL.GetAllPits(); IEnumerable <Show> allShows = ShowsDAL.GetAllShows(); IEnumerable <Staff> allStaff = StaffDAL.GetAllStaff(); model._shows_vm.LstShows = allShows; model._shows_vm.LstAllClubs = allClubs; model._shows_vm.LstAllDates = allDates; model._casts_vm.LstCasts = allCasts; model._casts_vm.LstAllMembers = allMembers; model._casts_vm.LstAllShows = allShows; model._exec_vm.LstExec = allExec; model._exec_vm.LstAllMembers = allMembers; model._exec_vm.LstAllClubs = allClubs; model._exec_vm.LstAllDates = allDates; model._members_vm.LstMembers = allMembers; model._pits_vm.LstPits = allPits; model._pits_vm.LstAllMembers = allMembers; model._pits_vm.LstAllShows = allShows; model._staff_vm.LstStaff = allStaff; model._staff_vm.LstAllMembers = allMembers; model._staff_vm.LstAllShows = allShows; return(View(model)); }
public ActionResult StaffMain(IFormCollection formData) { List <Staff> staffList = staffContext.GetAllStaff(); string email = formData["txtemail"].ToString().ToLower(); string password = formData["txtPassword"].ToString(); foreach (Staff s in staffList) { if (email == s.EmailAddr && password == s.Password) { HttpContext.Session.SetString("Email", email); HttpContext.Session.SetString("Password", password); return(RedirectToAction("StaffMain")); } } @TempData["Message"] = "Incorrect credentials"; return(RedirectToAction("StaffLogin")); }
public ActionResult InsertStaff(string StrPosition, int IntMemberID, int IntShowID) { Staff newStaff = new Staff { StrPosition = StrPosition, IntMemberID = IntMemberID, Member = MembersDAL.GetMember(IntMemberID), IntShowID = IntShowID, Show = ShowsDAL.GetShow(IntShowID) }; bool success = StaffDAL.InsertStaff(newStaff); StaffVM model = new StaffVM() { LstStaff = StaffDAL.GetAllStaff(), LstAllMembers = MembersDAL.GetAllMembers(), LstAllShows = ShowsDAL.GetAllShows() }; return(PartialView("CRUDPartials/_Staff", model)); }
public static List <Staff> GetAllStaff() { return(StaffDAL.GetAllStaff()); }