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))); }
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(); }
public IActionResult Create() { var inputModel = new DestinationInputModel(); return(this.View(inputModel)); }