コード例 #1
0
        public async Task <IActionResult> Create(DestinationInputModel inputModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(inputModel));
            }

            await this.destinationsService.CreateAsync(inputModel);

            return(this.RedirectToAction(nameof(this.Index)));
        }
コード例 #2
0
        public async Task CreateAsync(DestinationInputModel inputModel)
        {
            var destination = new Destination
            {
                Continent = inputModel.Continent,
                Country   = inputModel.Country,
                Town      = inputModel.Town,
            };

            await this.destinationsRepository.AddAsync(destination);

            await this.destinationsRepository.SaveChangesAsync();
        }
コード例 #3
0
        public IActionResult Create()
        {
            var inputModel = new DestinationInputModel();

            return(this.View(inputModel));
        }