Esempio n. 1
0
        public async Task <IActionResult> PutSection(int id, Section section)
        {
            if (id != section.SectionId)
            {
                return(BadRequest());
            }

            _context.Entry(section).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SectionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutTicketPurchase(int id, TicketPurchase ticketPurchase)
        {
            if (id != ticketPurchase.PurchaseId)
            {
                return(BadRequest());
            }

            _context.Entry(ticketPurchase).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TicketPurchaseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 3
0
        public async Task <ActionResult <Event> > PostEvent(Event @event)
        {
            _context.Event.Add(@event);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEvent", new { id = @event.EventId }, @event));
        }
Esempio n. 4
0
        public async Task <IActionResult> PutEventSeat(int id, EventSeat eventSeat)
        {
            if (id != eventSeat.EventSeatId)
            {
                return(BadRequest());
            }

            _context.Entry(eventSeat).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EventSeatExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 5
0
        public async Task <IActionResult> PutVenue(string id, Venue venue)
        {
            if (id != venue.VenueName)
            {
                return(BadRequest());
            }

            _context.Entry(venue).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VenueExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 6
0
 public async Task Add(Customer customer)
 {
     _context.Customers.Add(customer);
     await _context.SaveChangesAsync();
 }
Esempio n. 7
0
 public async Task <bool> SaveChangesAsync()
 {
     // return true if 1 or more entities were changed
     return(await _context.SaveChangesAsync() > 0);
 }
Esempio n. 8
0
 public async Task <bool> SaveChangesAsync()
 {
     return(await _context.SaveChangesAsync() > 0);
 }