// GET: LocHourCats/Edit/5 public ActionResult Edit(int? id) { if (id == null) { TempData["alert"] = "Sorry, I could not find the item you were looking for. Please try again."; return View("~/Locations"); } LocHourCats locHours = context.LocHourCats.FirstOrDefault(p => p.Id == id); LocationCatsViewModel model = new LocationCatsViewModel { Location = context.Locations.FirstOrDefault(l => l.Id == locHours.LocationId), LocHourCats = locHours }; if (locHours == null) { return HttpNotFound(); } return View(model); }
// GET: LocHourCats public ActionResult Manage(int id) { LocationCatsViewModel model = new LocationCatsViewModel { Location = context.Locations .FirstOrDefault(p => p.Id == id), LocHourCats = new LocHourCats() }; return View(model); }