// GET: Flights/Create public IActionResult Create() { FlightViewModel vm = new FlightViewModel { AirportsList = _airportService.GetAll() }; return(View(vm)); }
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) })); }
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)); }
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")); } }
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()); }
public IActionResult GetAll() { var airports = _airportService.GetAll(); return(Ok(airports)); }
public async Task <IEnumerable <AirportViewModel> > Get() { return((await _airportService.GetAll()).Select(ur => ur.ToViewModel())); }
// GET: Airports public IActionResult Index() { return(View(_airportService.GetAll()?.ConvertAll(a => new AirportViewModel(a)))); }
public virtual IEnumerable <AirportDTO> GetAll() { return(service.GetAll()); }