public async Task <IActionResult> PostAsync(AirportPostOptions options)
        {
            _airportManager.Post(options);
            await _airportManager.SaveChangesAsync();

            return(RedirectToAction("GetPage"));
        }
Exemplo n.º 2
0
        public AirportModel SeedAirport(AirportPostOptions options)
        {
            var model = AirportManager.Post(options);

            AirportManager.SaveChanges();
            return(model);
        }
Exemplo n.º 3
0
        public AirportModel Post(AirportPostOptions options)
        {
            var model = new AirportModel
            {
                Name      = options.Name,
                Latitude  = options.Latitude,
                Longitude = options.Longitude,
            };

            Context.Airports.Add(model);

            return(model);
        }
Exemplo n.º 4
0
        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());
        }
Exemplo n.º 5
0
        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());
        }