Exemplo n.º 1
0
        public async Task <bool> AddCustomer(Customer customer)
        {
            await _context.AddAsync(customer);

            if (await _context.SaveChangesAsync() > 0)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public async Task <bool> AddReservation(Reservation reservation)
        {
            await _context.AddAsync(reservation);

            if (await _context.SaveChangesAsync() > 0)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
        public async Task <bool> AddPricePerPeople(PricePerPeople pricePerPeople)
        {
            await _context.AddAsync(pricePerPeople);

            if (await _context.SaveChangesAsync() > 0)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 4
0
        public async Task <bool> AddObjectForRent(ObjectForRent objectForRent)
        {
            await _context.AddAsync(objectForRent);

            if (await _context.SaveChangesAsync() > 0)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 5
0
        public async Task <bool> CreateTicket(Ticket ticket)
        {
            var createTicket = await _dataContext.SeatStatuses.FirstOrDefaultAsync(ss => ss.StatusId == ticket.StatusId);

            if (createTicket == null)
            {
                throw new NullReferenceException("Selected seat status doesn't exist");
            }

            await _dataContext.AddAsync(ticket);

            var created = await _dataContext.SaveChangesAsync();

            return(created > 0);
        }
Exemplo n.º 6
0
        public async Task <bool> CreateSeat(Seat seat)
        {
            var types = _dataContext.SeatTypes.Where(st => st.TypeId == seat.TypeId).FirstOrDefault();

            if (types == null)
            {
                throw new NullReferenceException("Selected type doesn't exist");
            }

            var places = _dataContext.Places.Where(p => p.PlaceId == seat.PlaceId).FirstOrDefault();

            if (places == null)
            {
                throw new NullReferenceException("Selected place doesn't exist");
            }

            await _dataContext.AddAsync(seat);

            var created = await _dataContext.SaveChangesAsync();

            return(created > 0);
        }