public async Task <ActionResult <List <TicketDTO> > > GetAllTickets()
        {
            TicketProfile ticketProfile = new TicketProfile();

            AuthenticateAndGetTokenAndGetFacade(out LoginToken <AirlineCompany>
                                                token_airline, out LoggedInAirlineFacade facade);

            List <TicketDTO> result = null;

            try
            {
                List <Ticket> list = await Task.Run(() => facade.GetAllTickets(token_airline)) as List <Ticket>;

                List <TicketDTO> ticketDTOList = new List <TicketDTO>();

                foreach (Ticket ticket in list)
                {
                    TicketDTO ticketDTO = m_mapper.Map <Ticket, TicketDTO>(ticket);
                    ticketDTOList.Add(ticketDTO);
                }
                result = ticketDTOList;
            }
            catch (Exception ex)
            {
                return(StatusCode(400, $"{{ error: \"{ex.Message}\" }}"));
            }
            if (result == null)
            {
                return(StatusCode(204, "{ }"));
            }
            return(Ok(result));
        }
Exemplo n.º 2
0
        public TicketProfile TicketProfileVIP()
        {
            TicketProfile ticketProfileOne = new TicketProfile();

            ticketProfileOne.serviceClass = ServiceClass.B.ToString();
            ticketProfileOne.stops        = "0,1";
            List <int> mastransportTypes = new List <int>();

            mastransportTypes.Add(1);
            mastransportTypes.Add(2);
            mastransportTypes.Add(3);
            ticketProfileOne.transportTypes = mastransportTypes;
            return(ticketProfileOne);
        }