// GET: AirPorts public ActionResult Index(string id) { var viewModel = new AirPortIndexData(); viewModel.AirPorts = _AirPortService.GetAll(); if (id != null) { ViewBag.AirPortID = id; viewModel.AirPlanes = _AirPlaneService.GetAll().Where(i => i.AirPortId == id); viewModel.Helicopters = _HelicopterService.GetAll().Where(i => i.AirPortId == id); } return(View(viewModel)); }
// GET: Helicopters/Edit/5 public ActionResult Edit(string id) { ViewBag.AirPlaneId = id; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Helicopter helicopter = _HelicopterService.GetById(id); if (helicopter == null) { return(HttpNotFound()); } ViewBag.AirPortId = new SelectList(_AirPortService.GetAll(), "Id", "Name", helicopter.AirPortId); return(View(helicopter)); }