Ejemplo n.º 1
0
        // GET: Flights/Create
        public IActionResult Create()
        {
            FlightViewModel vm = new FlightViewModel
            {
                AirportsList = _airportService.GetAll()
            };

            return(View(vm));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> List()
        {
            var collection = await _airportService.GetAll();

            return(Ok(new AirportListResponse()
            {
                Data = Mapper.ConvertEntityToSchema <AirportSchema>(collection)
                       .OrderBy(x => x.State)
                       .ThenBy(x => x.City)
            }));
        }
Ejemplo n.º 3
0
        public ActionResult Index()
        {
            IEnumerable <AirportDTO> airportDTOs = airportService.GetAll();
            var airports = airportDTOs.Select(a => new AirportViewModel
            {
                Id      = a.Id,
                Name    = a.Name,
                Address = a.Address,
                Country = a.Country
            });

            return(View(airports));
        }
Ejemplo n.º 4
0
 public IActionResult GetAllAirports()
 {
     try
     {
         var airports = _airportService.GetAll();
         _logger.LogInfo("Returned all airports");
         return(Ok(airports));
     }
     catch (Exception ex)
     {
         _logger.LogError($"AirportController::GetAllAirports::{ex.Message}");
         return(StatusCode(500, "Internal Server Error"));
     }
 }
Ejemplo n.º 5
0
 public IActionResult GetAllAirports()
 {
     try
     {
         var airports = _airportService.GetAll();
         if (!airports.Any())
         {
             return(NotFound());
         }
         return(Ok(airports));
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message, "Failed to retrieve airports");
         return(BadRequest("Failed to retrieve airports"));
     }
 }
        public void GetAll_ShouldReturnsCorrectCountOfAirports()
        {
            mockRepository.Setup(m => m.GetAll()).Returns(new List <Airport>()
            {
                new Airport {
                    AirportId = 1, Name = "airport1", Address = "address1", Country = "country1"
                },
                new Airport {
                    AirportId = 2, Name = "airport2", Address = "address2", Country = "country2"
                },
                new Airport {
                    AirportId = 3, Name = "airport3", Address = "address3", Country = "country3"
                }
            });
            var airports = airportService.GetAll();

            Assert.AreEqual(3, airports.Count());
        }
Ejemplo n.º 7
0
        public IActionResult GetAll()
        {
            var airports = _airportService.GetAll();

            return(Ok(airports));
        }
 public async Task <IEnumerable <AirportViewModel> > Get()
 {
     return((await _airportService.GetAll()).Select(ur => ur.ToViewModel()));
 }
Ejemplo n.º 9
0
 // GET: Airports
 public IActionResult Index()
 {
     return(View(_airportService.GetAll()?.ConvertAll(a => new AirportViewModel(a))));
 }
 public virtual IEnumerable <AirportDTO> GetAll()
 {
     return(service.GetAll());
 }