Пример #1
0
        public async Task <IActionResult> Create(int?id, [Bind("Season,Date,Number,Name,Venue,Status")] Round round)
        {
            if (id == null)
            {
                return(NotFound());
            }

            await _roundModelStatePopulator.ValidateAndPopulateForCreate(ModelState, round);

            if (ModelState.IsValid)
            {
                await _roundService.PersistRound(round);

                return(RedirectToAction(nameof(Index), new { id = id.Value }));
            }

            var roundDisplayModel = await _roundService.CreateForRound(round);

            if (roundDisplayModel == null)
            {
                return(NotFound());
            }
            return(View(roundDisplayModel));
        }