public async Task <IActionResult> PostAsync(AirportPostOptions options) { _airportManager.Post(options); await _airportManager.SaveChangesAsync(); return(RedirectToAction("GetPage")); }
public AirportModel SeedAirport(AirportPostOptions options) { var model = AirportManager.Post(options); AirportManager.SaveChanges(); return(model); }
public AirportModel Post(AirportPostOptions options) { var model = new AirportModel { Name = options.Name, Latitude = options.Latitude, Longitude = options.Longitude, }; Context.Airports.Add(model); return(model); }
public async Task Should_Get_One_Then_Zero_Airport() { _fixture.EmptyDatabase(); var options = new AirportPostOptions { Name = "0001", }; var model = _fixture.AirportManager.Post(options); _fixture.AirportManager.SaveChanges(); Assert.Equal(1, _fixture.AirportManager.GetPage().Data.Count()); await _fixture.AirportManager.DeleteAsync(model.PublicId); _fixture.AirportManager.SaveChanges(); Assert.Equal(0, _fixture.AirportManager.GetPage().Data.Count()); }
public void Should_Get_One_Then_Three_Airports() { _fixture.EmptyDatabase(); var options = new AirportPostOptions { Name = "0001", }; _fixture.AirportManager.Post(options); _fixture.AirportManager.SaveChanges(); Assert.Equal(1, _fixture.AirportManager.GetPage().Data.Count()); options.Name = "0002"; _fixture.AirportManager.Post(options); options.Name = "0003"; _fixture.AirportManager.Post(options); _fixture.AirportManager.SaveChanges(); Assert.Equal(3, _fixture.AirportManager.GetPage().Data.Count()); }