Beispiel #1
0
        public async Task <IActionResult> ReservationTicketPost(ViewCreateReservation viewCreateReservation)
        {
            Person currentuser = await GetCurrentUserAsync();

            TblFestivalsDTO tblFestivalsDTO = new TblFestivalsDTO()
            {
                MusicEvenementName = viewCreateReservation.SelectedFestival
            };
            var GetFestivalId = _FestivalRepo.GetFestivalName(tblFestivalsDTO);

            TblPriceDTO tblPriceDTO = new TblPriceDTO()
            {
                Name = viewCreateReservation.SelectedPriceType
            };
            var GetFestivalTypeId = _FestivalRepo.GetFestivalTypeCategory(tblPriceDTO);

            TblReservation tblReservation = new TblReservation()
            {
                MusicEvementId = GetFestivalId.Result.MusicEvenementId,
                Price          = GetFestivalTypeId.Result
            };

            var getPrice = await _FestivalRepo.GetPriceofCurrentFestivalType(tblReservation);

            TblReservationDTO tblReservationDTO = new TblReservationDTO()
            {
                MusicEvement = new TblFestivalsDTO()
                {
                    MusicEvenementName = viewCreateReservation.SelectedFestival,
                    Name = viewCreateReservation.SelectedPriceType
                },
                Price = new TblPriceDTO()
                {
                    Name  = viewCreateReservation.SelectedPriceType,
                    Price = getPrice.Price
                },
                User = new AspNetUserDTO()
                {
                    Email = currentuser.Email
                }
            };
            await _reservationsController.PostReservation(tblReservationDTO);

            AspNetUsers user = new AspNetUsers()
            {
                Id    = currentuser.Id,
                Email = currentuser.Email
            };

            var model = await _reservationRepo.GetReservationsOfUser(user);

            if (model.Count == 0)
            {
                return(RedirectToAction("ReservationTicket"));
            }
            else
            {
                return(View("Reservations", model));
            }
        }
Beispiel #2
0
        public IActionResult ReservationTicket()
        {
            var GetFestivals = _FestivalRepo.GetFestivals();
            ViewCreateReservation viewCreateReservation = new ViewCreateReservation()
            {
                Festivals = GetFestivals.Result
            };

            return(View("ReservationTicket", viewCreateReservation));
        }