public IActionResult Get() { try { var flights = _repository.GetAllFlights(); var link = new LinkHelper <List <Flights> >(flights); for (int iIndex = 0; iIndex < flights.Count || (iIndex < flights.Count && iIndex < 10); iIndex++) // Restrict max 10 links { link.Links.Add(new Link { Href = Url.Link("GetFlights", new { flights[iIndex].FlightId }), Rel = "GET-booking", method = "GET" }); } return(Ok(link)); } catch (Exception ex) { return(BadRequest(ExceptionHelper.ProcessError(ex))); } }
public ActionResult <IEnumerable <Flight> > Get() { return(Ok(_flightsRepository.GetAllFlights())); }
public async Task <IActionResult> Flights() { var flights = await _flightsRepository.GetAllFlights(); return(View(flights)); }