public ActionResult AddDVD(AddDVDVM vm) { var repo = new DVDRepo(); if (ModelState.IsValid) { int dvdid = repo.AddDVD(vm.DvdToAdd); foreach (var actorId in vm.ActorSelectedValues) { repo.AddDVDActorDetails(dvdid, actorId); } return View("SuccessPage"); } else { vm.CreateActorList(repo.GetAllActors()); vm.CreateMPAAList(repo.GetAllMPAA()); vm.CreateStudioList(repo.GetAllStudios()); return View("AddDVD", vm); } }
public ActionResult AddDVD() { var repo = new DVDRepo(); var vm = new AddDVDVM(); vm.CreateActorList(repo.GetAllActors()); vm.CreateMPAAList(repo.GetAllMPAA()); vm.CreateStudioList(repo.GetAllStudios()); return View("AddDVD", vm); }