Exemplo n.º 1
0
        private void LoadPrices(int selectedIndex = -1)
        {
            _prices = _prices.OrderBy(m => m.Id).ToList();
            var table = new TblPrice(_prices);

            this.gridPrice.DataSource = table;
            if (selectedIndex < 0)
            {
                this.gridPrice.ClearSelection();
            }
            else
            {
                this.gridPrice.Rows[selectedIndex].Selected = true;
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult> PostReservation([FromBody] TblReservationDTO tblReservationDTO)
        {
            try
            {
                AspNetUserDTO aspNetUserDTO = new AspNetUserDTO();
                aspNetUserDTO.Email = tblReservationDTO.User.Email;

                AspNetUsers aspNetUser = await _userRepo.GetUser(aspNetUserDTO);

                TblFestivalsDTO tblFestivalsDTO = new TblFestivalsDTO();
                tblFestivalsDTO.MusicEvenementName = tblReservationDTO.MusicEvement.MusicEvenementName;

                TblFestivals tblFestivals = new TblFestivals();
                tblFestivals = await _festivalRepo.GetFestivalName(tblFestivalsDTO);

                TblPriceDTO tblPriceDTOGetCat = new TblPriceDTO()
                {
                    Name = tblReservationDTO.Price.Name
                };

                TblPrice tblPriceCat = new TblPrice();
                tblPriceCat = await _festivalRepo.GetFestivalTypeCategory(tblPriceDTOGetCat);

                TblReservation tblTempReservation = new TblReservation();
                tblTempReservation.MusicEvementId = tblFestivals.MusicEvenementId;
                tblTempReservation.Price          = new TblPrice()
                {
                    Price = tblReservationDTO.Price.Price,
                    Type  = tblPriceCat.Type
                };
                int NumberOfSeat;

                if (tblReservationDTO.Seat != null)
                {
                    NumberOfSeat = tblReservationDTO.Seat.SeatNumber;
                }
                else
                {
                    NumberOfSeat = 0;
                }


                TblPrice tblPrice = new TblPrice();
                tblPrice = await _festivalRepo.GetPrice(tblTempReservation);

                Guid           NewSeatId        = Guid.NewGuid();
                Guid           NewReservationId = Guid.NewGuid();
                TblReservation tblReservation   = new TblReservation()
                {
                    ReservationId  = NewReservationId,
                    Userid         = aspNetUser.Id,
                    MusicEvementId = tblFestivals.MusicEvenementId,
                    PriceId        = tblPrice.Priceid,
                    SeatId         = NewSeatId,
                    Seat           = new TblSeat()
                    {
                        SeatId     = NewSeatId,
                        SeatNumber = NumberOfSeat
                    }
                };

                await _reservationRepo.AddnewReservatie(tblReservation);

                return(new OkObjectResult(200));
            }
            catch (Exception ex)
            {
                return(new StatusCodeResult(400));
            }
        }