コード例 #1
0
        public async Task <int> DeleteTicketAsync(int id)
        {
            var ticket = _dbContext.Tickets.Where(x => x.TicketId == id);

            if (ticket != null)
            {
                _dbContext.Remove(ticket);
            }

            return(await _dbContext.SaveChangesAsync());
        }
コード例 #2
0
        public async Task <int> SaveTicketSaleAsync(Buyer buyer)
        {
            if (buyer.Id < 0)
            {
                await _dbContext.Buyers.AddAsync(buyer);
            }

            return(await _dbContext.SaveChangesAsync());
        }
コード例 #3
0
        public async Task <int> SaveTicketSaleAsync(TicketSale ticketResponse, Buyer buyer, Ticket ticket)
        {
            await _dbContext.Buyers.AddAsync(buyer);

            ticketResponse.Buyer = buyer;


            await _dbContext.TicketSales.AddAsync(ticketResponse);

            ticket.TicketSale = ticketResponse;
            await _dbContext.Tickets.AddAsync(ticket);

            return(await _dbContext.SaveChangesAsync());
        }