// GET: BomTrackers/Edit/5 public ActionResult Edit(int?id) { var boms = db.BomTrackers.SingleOrDefault(c => c.BomTrackerId == id); var statuses = db.BomStatuses.ToList(); var viewModel = new SaveBomTrackerViewModel() { BomTracker = boms, BomStatuses = statuses, }; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //BomTracker bomTracker = db.BomTrackers.Find(id); BomTracker bomTracker = db.BomTrackers.Include(s => s.FileBomDetails).SingleOrDefault(x => x.BomTrackerId == id); if (bomTracker == null) { return(HttpNotFound()); } return(View("Edit", viewModel)); //return View(bomTracker); }
// GET: BomTrackers/Create public ActionResult Create() { ViewBag.ReturnUrl = Request.UrlReferrer; var statuses = db.BomStatuses.ToList(); var viewModel = new SaveBomTrackerViewModel() { BomStatuses = statuses, }; //return View(); return(View("Create", viewModel)); }