Exemple #1
0
 // 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);
 }
Exemple #2
0
 public ActionResult Create(ShowViewModel vm)
 {
     try
     {
         _repo.Persist(vm.ShowModel);
         return RedirectToAction("Index");
     }
     catch
     {
         return View("Edit", vm);
     }
 }
Exemple #3
0
 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);
     }
 }
Exemple #4
0
 // GET: /Show/Create
 public ActionResult Create()
 {
     Show show = new Show();
     var model = new ShowViewModel{ShowModel = show};
     return View("Edit", model);
 }