public ActionResult AddOrUpdate(NewVideoGameViewModel vm)
        {
            VideoGameService.AddNewGameOrUpdate(new VideoGame {
                Description = vm.Description, Name = vm.VideoGameName, PlatformId = vm.SelectedPlatformId, RatingId = vm.SelectedRatingId, ReleasedDate = (vm.ReleasedDate ?? DateTime.Now), Rented = vm.Rented, UPC = vm.UPC
            });

            return(RedirectToAction("Index", "Home"));
        }
예제 #2
0
        public ActionResult Index()
        {
            //get list of platforms from database
            var platforms = PlatformService.GetAll();
            var ratings   = RatingService.GetAll();


            var ratingsSelectList  = new SelectList(ratings, "Id", "Name");
            var platformSelectList = new SelectList(platforms, "Id", "Name");

            var vm = new NewVideoGameViewModel {
                RatingOptions = ratingsSelectList, PlatformOptions = platformSelectList
            };

            return(View(vm));
        }
예제 #3
0
        public ActionResult Index()
        {
            var vm = new NewVideoGameViewModel();

            return(View(vm));
        }