public ActionResult Create(MSTR_Pilot_Log PilotLog) { if (!exLogic.User.hasAccess("PILOTLOG.CREATE")) { return(RedirectToAction("NoAccess", "Home")); } if (PilotLog.DroneId < 1 || PilotLog.DroneId == null) { ModelState.AddModelError("DroneID", "You must select a UAS."); } if (ModelState.IsValid) { ExponentPortalEntities db = new ExponentPortalEntities(); db.MSTR_Pilot_Log.Add(PilotLog); db.SaveChanges(); db.Dispose(); return(RedirectToAction("UserDetail", "User", new { ID = PilotLog.PilotId })); } else { ViewBag.Title = "Create Drone Flight"; return(View(PilotLog)); } }
// GET: PilotLog/Edit/5 public ActionResult Edit([Bind(Prefix = "ID")] int LogId = 0) { if (!exLogic.User.hasAccess("PILOTLOG.EDIT")) { return(RedirectToAction("NoAccess", "Home")); } ViewBag.Title = "Edit Pilot Log"; ExponentPortalEntities db = new ExponentPortalEntities(); MSTR_Pilot_Log PilotLog = db.MSTR_Pilot_Log.Find(LogId); return(View(PilotLog)); }
// GET: PilotLog/Create public ActionResult Create([Bind(Prefix = "ID")] int PilotID = 0) { if (!exLogic.User.hasAccess("PILOTLOG.CREATE")) { return(RedirectToAction("NoAccess", "Home")); } ViewBag.Title = "Create Pilot Log"; MSTR_Pilot_Log PilotLog = new MSTR_Pilot_Log(); PilotLog.PilotId = PilotID; PilotLog.Date = DateTime.Now; return(View(PilotLog)); }
public ActionResult Edit(MSTR_Pilot_Log PilotLog) { try { if (!exLogic.User.hasAccess("PILOTLOG.EDIT")) { return(RedirectToAction("NoAccess", "Home")); } ViewBag.Title = "Edit Pilot Log"; ExponentPortalEntities db = new ExponentPortalEntities(); db.Entry(PilotLog).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("UserDetail", "User", new { ID = PilotLog.PilotId })); } catch { return(View()); } }