public async Task <IActionResult> Create(FlightCompanyInputModel inputModel) { if (!this.ModelState.IsValid) { return(this.View(inputModel)); } await this.flightCompaniesService.CreateAsync(inputModel); return(this.RedirectToAction(nameof(this.Index))); }
public async Task CreateAsync(FlightCompanyInputModel inputModel) { var company = new FlightCompany { Name = inputModel.Name, }; await this.flightCompaniesRepository.AddAsync(company); await this.flightCompaniesRepository.SaveChangesAsync(); }
public IActionResult Create() { var inputModel = new FlightCompanyInputModel(); return(this.View(inputModel)); }