// GET: /Show/Edit/5 public ActionResult Edit(int id) { var show = _repo.Fetch(id).FirstOrDefault(); var model = new ShowViewModel { ShowModel = show }; if (model == null) return HttpNotFound(); return View(model); }
public ActionResult Create(ShowViewModel vm) { try { _repo.Persist(vm.ShowModel); return RedirectToAction("Index"); } catch { return View("Edit", vm); } }
public ActionResult Edit(ShowViewModel vm) { try { //var model = _repo.Fetch(vm.ShowModel.ShowId).FirstOrDefault(); //if (model == null) return HttpNotFound(); //model.Title = vm.ShowModel.Title; //model.LengthInMinutes = vm.ShowModel.LengthInMinutes; //model.TheatricalReleaseDate = vm.ShowModel.TheatricalReleaseDate; //model.DvdReleaseDate = vm.ShowModel.DvdReleaseDate; //model.MpaaRatingId = vm.ShowModel.MpaaRatingId; vm.ShowModel.IsDirty = true; _repo.Persist(vm.ShowModel); return RedirectToAction("Index"); } catch { return View(vm); } }
// GET: /Show/Create public ActionResult Create() { Show show = new Show(); var model = new ShowViewModel{ShowModel = show}; return View("Edit", model); }