Ejemplo n.º 1
0
        public async Task <ActionResult <PassengerDto[]> > GetAllPassengers(bool timeTable)
        {
            try
            {
                var result = await _passengerRepository.GetPassengers(timeTable);

                var passengerresult = _mapper.Map <PassengerDto[]>(result).Select(m => HateoasMainLinksPassenger(m));
                if (result == null)
                {
                    return(NotFound("Could not find any passengers."));
                }

                return(Ok(passengerresult));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database failor: {e.Message}"));
            }
        }
Ejemplo n.º 2
0
 public IEnumerable <Passenger> GetPassengers()
 {
     return(_passengerRepository.GetPassengers().OrderBy(p => p.Seat));
 }
Ejemplo n.º 3
0
 public IList <Passenger> Get()
 {
     return(_passengerRepository.GetPassengers());
 }
        public ActionResult Index()
        {
            var passengers = _passengerRepository.GetPassengers();

            return(View(passengers));
        }