// GET: FlightPersonnel/Details/5 public ActionResult Details(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") != "Admin")) { return(RedirectToAction("Index", "Home")); } FlightPersonnel flightPersonnel = staffContext.GetDetails(id); List <StaffViewModel> staffVM = MapToStaffVM(flightPersonnel); return(View(staffVM)); }
// GET: FlightPersonnelController/Delete/5 public ActionResult Delete(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")); } FlightPersonnel flightpersonnel = flightpersonnelContext.GetDetails(id.Value); if (flightpersonnel == null) { //Return to listing page, not allowed to edit return(RedirectToAction("Index")); } return(View(flightpersonnel)); }