public ActionResult Create(PilotModel pilotModel) { try { if (!ModelState.IsValid) return PartialView(pilotModel); var pilotNew = PilotFactory.CreateNewPilot(pilotModel.Name, pilotModel.DebutDate.ToString(CultureInfo.InvariantCulture), pilotModel.Age, pilotModel.Team); _pilotRepository.AddPilot(pilotNew); return PartialView("PilotTable", _pilotRepository.GetAllPilots()); } catch (Exception ex) { Logger.AddMsgToLog(ex.Message + "\n" + ex.StackTrace); return View(); } }
public ActionResult Details(int id) { var pilot = _pilotRepository.GetPilot(id); var modelPilot = new PilotModel(pilot); return PartialView(modelPilot); }
public ActionResult Edit(int id, PilotModel editedPilot) { try { var oldPilot = _pilotRepository.GetPilot(id); _pilotRepository.UpdatePilot(oldPilot, new PilotUpdateDto { Id = id, Name = editedPilot.Name, Debutdate = editedPilot.DebutDate.ToString(), Age = editedPilot.Age, Team = editedPilot.Team }); return PartialView("PilotTable", _pilotRepository.GetAllPilots()); } catch (Exception ex) { Logger.AddMsgToLog(ex.Message + "\n" + ex.StackTrace); return View(); } }
public ActionResult Create() { var model = new PilotModel(); return PartialView(model); }
public ActionResult Edit(int id) { var oldPilot = _pilotRepository.GetPilot(id); var modelPilot = new PilotModel(oldPilot); return PartialView(modelPilot); }