예제 #1
0
        public async Task <Band> InsertBandAsync(Band newBand)
        {
            _context.Bands.Add(newBand);
            await _context.SaveChangesAsync();

            return(newBand);
        }
예제 #2
0
        public async Task <Venue> InsertVenueAsync(Venue newVenue)
        {
            _context.Venues.Add(newVenue);
            await _context.SaveChangesAsync();

            return(newVenue);
        }
예제 #3
0
        public async Task <Concert> InsertConcertAsync(Concert newConcert, List <Band> bands)
        {
            bands.ForEach(b =>
            {
                var concertBand = new ConcertBand {
                    Band = _context.Bands.Find(b.Id), Concert = newConcert
                };
                newConcert.ConcertBands.Add(concertBand);
            });

            _context.Concerts.Add(newConcert);
            await _context.SaveChangesAsync();

            return(newConcert);
        }