Exemplo n.º 1
0
        public async Task <IActionResult> TicketCreate(TicketPickExcursionViewModel model)
        {
            var userId    = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var excursion = model.PickedExcursion;

            if (excursion is null)
            {
                //TODO: proper exception !
                this.Redirect("/Home/Index");
            }

            List <LanguageViewModel> spokenLanguages = await ticketServices.GetLanguagesForExcursion(excursion.Id);

            var input = await this.
                        ticketServices
                        .FillGetTicketCreateInputModel(excursion, spokenLanguages, userId);

            return(this.View(input));
        }
Exemplo n.º 2
0
        public async Task <TicketPickExcursionViewModel> GetExcursionsForTicketCreateView()
        {
            var excursionPickViewModel = new TicketPickExcursionViewModel()
            {
                Excursions = await context.Excursions.Select(e => new TicketExcursionViewModel
                {
                    AvailableSpots = e.AvailableSpots,
                    PricePerChild  = e.PricePerChild,
                    Id             = e.Id,
                    Name           = e.ExcursionType.Name,
                    PricePerAdult  = e.PricePerAdult,
                    Departure      = e.Departure,
                    Arrival        = e.Arrival,
                    StartPoint     = e.StartingPoint,
                    EndPoint       = e.EndPoint
                })
                             .ToListAsync(),
            };

            return(excursionPickViewModel);
        }