Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
            }
        }