public async Task <ActionResult> Create([Bind(Include = "ID,SeasonID,Week,GuestName,GuestScore,HostName,HostScore,WinnerName,LoserName,IsPlayoffGame,Notes")] GameViewModel gameViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _service.SetSelectedWeek(gameViewModel.Week);

                    await _service.AddEntity(gameViewModel);

                    return(RedirectToAction("Create", new { seasonID = gameViewModel.SeasonID }));
                }

                var seasons = await _sharedService.GetSeasonsOrderedAsync();

                ViewBag.SeasonID = new SelectList(seasons, "ID", "ID", gameViewModel.SeasonID);

                ViewBag.Week = GamesService.SelectedWeek.ID;

                var teams = await _service.GetTeamsAsync();

                ViewBag.GuestName = new SelectList(teams, "Name", "Name", gameViewModel.GuestName);
                ViewBag.HostName  = new SelectList(teams, "Name", "Name", gameViewModel.HostName);

                return(View(gameViewModel));
            }
            catch (Exception ex)
            {
                _log.Error("Exception in GamesController.Create (POST): " + ex.Message);
                throw;
            }
        }
        public async Task CreatePost_ModelStateValid()
        {
            // Arrange
            var controller = new GamesController(_service, _sharedService);

            var gameViewModel = new GameViewModel
            {
                SeasonID = 2017
            };

            // Act
            var result = await controller.Create(gameViewModel);

            // Assert
            A.CallTo(() => _service.SetSelectedWeek(gameViewModel.Week)).MustHaveHappenedOnceExactly();
            A.CallTo(() => _service.AddEntity(gameViewModel, null)).MustHaveHappenedOnceExactly();

            Assert.IsInstanceOf <RedirectToRouteResult>(result);
            var resultAsRedirectToRouteResult = result as RedirectToRouteResult;

            Assert.AreEqual("Create", resultAsRedirectToRouteResult.RouteValues["action"]);
            Assert.AreEqual(gameViewModel.SeasonID, resultAsRedirectToRouteResult.RouteValues["seasonID"]);
        }