public async Task <FlightDetailsResponse> GetDetails(int flightId) { var temp = await repo.GetFlightAsync(flightId); if (temp != null) { var ret = new FlightDetails(); var airplane = await seatService.GetSeats(flightId); if (airplane.Success) { ret.Airplane = airplane.Resource; ret.Extras = temp.PaidExtras; ret.LuggageOptions = temp.WeightPricings; ret.Price = temp.Price; return(new FlightDetailsResponse(ret)); } else { return(new FlightDetailsResponse("Unable to retrieve flight details")); } } else { return(new FlightDetailsResponse("Flight with given id does not exist .")); } }
public async Task <IActionResult> GetSeat(int flightId) { var ret = await service.GetSeats(flightId); if (ret.Success) { return(Ok(mapper.Map <FlightResource>(ret.Resource))); } else { return(BadRequest(new { Message = ret.Message })); } }
public async Task <IActionResult> GetAllOrFilter([FromQuery] FilterSeatsRequest filterSeats) { return(Ok(await _seatService.GetSeats(filterSeats))); }