Exemplo n.º 1
0
        public IActionResult Create()
        {
            var viewModel = new CourtCreateViewModel
            {
                Towns = this.courtService.GetAllCourtTowns()
            };

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create(CourtCreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(this.View(model));
            }

            await this.courtService.CreateAsync(model.CourtType, model.CourtTownId);

            return(this.RedirectToAction(nameof(All)));
        }