public IActionResult Get(int flightid) { try { var flight = _repository.GetFlightById(flightid); if (flight != null) { var link = new LinkHelper <Flights>(flight); link.Links.Add(new Link { Href = Url.Link("Schedule", new { flight.FlightId }), Rel = "GET-schedule", method = "GET" }); return(Ok(link)); } else { return(NotFound("No flight available")); } } catch (Exception ex) { return(BadRequest(ExceptionHelper.ProcessError(ex))); } }