Example #1
0
        public ActionResult <FlightHistory> GetFlightHistoryByOriginalId(long id)
        {
            LoginToken <AirlineCompany> airline_token = DesirializeToken();
            FlightHistory flightHistory = null;

            try
            {
                flightHistory = _loggedInAirlineFacade.GetFlightHistoryByOriginalId(airline_token, id);
                if (flightHistory == null)
                {
                    return(NotFound());
                }

                if (flightHistory.AirlineCompanyId != airline_token.User.Id)
                {
                    return(Forbid());
                }
            }
            catch (NotAllowedAirlineActionException)
            {
                return(Forbid());
            }

            return(Ok(flightHistory));
        }