Пример #1
0
        // GET: StaffController/Edit/5
        public ActionResult Edit(int?id)
        {
            // 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"));
            }

            if (id == null)
            {
                // Query string parameter not provided
                // Return to listing page, not allowed to edit
                return(RedirectToAction("Index"));
            }

            ViewData["BranchList"] = GetAllBranches();

            Staff staff = staffContext.GetDetails(id.Value);

            if (staff == null)
            {
                // Return to listing page, not allowed to edit
                return(RedirectToAction("Index"));
            }

            return(View(staff));
        }
Пример #2
0
        // GET: Staff/Details/5
        public ActionResult ViewStaffSchedule(int?id)
        {
            if ((HttpContext.Session.GetString("Role") == null) ||
                (HttpContext.Session.GetString("Role") != "Admin"))
            {
                return(RedirectToAction("Index", "Home"));
            }
            List <FlightSchedule> ScheduleList       = scheduleContext.GetAllFlightSchedule();
            List <int>            CrewList           = crewContext.GetFlightCrewID(id.Value);
            List <FlightSchedule> EditedScheduleList = new List <FlightSchedule>();
            Staff s = staffContext.GetDetails(id.Value);

            TempData["StaffName"] = s.StaffName;
            foreach (int i in CrewList)
            {
                foreach (FlightSchedule j in ScheduleList)
                {
                    if (i == j.ScheduleId)
                    {
                        EditedScheduleList.Add(j);
                    }
                }
            }
            return(View(EditedScheduleList));
        }
        public ActionResult Edit(int id)
        {
            if (HttpContext.Session.GetString("Role") == "Part-timer")
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (id == null)
            {
                return(RedirectToAction("Index"));
            }

            Deployment deployment = staffContext.GetDetails(id);

            if (deployment == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(deployment));
        }