public ActionResult <List <User> > GetUserTickets([FromRoute] string id)
        {
            var user    = _userService.GetUser(id);
            var tickets = _ticketService.GetUserTickets(user.Email);

            return(Ok(tickets));
        }
Example #2
0
        public List <TicketDTO> GetUserTickets()
        {
            var id      = _userManager.GetUserId(User);
            var tickets = _ticketsService.GetUserTickets(id);
            var dtos    = tickets.Select(t => new TicketDTO
            {
                Id        = t.Id,
                Price     = t.Price,
                Discount  = t.Discount.Type,
                From      = t.From,
                To        = t.To,
                TrainName = t.Ride.Train.Name,
                WagonNo   = t.WagonNo,
                SeatNo    = t.SeatNo,
                RideDate  = t.RideDate
            }).ToList();

            return(dtos);
        }