示例#1
0
        public async Task DeleteBeer(int beerId)
        {
            var beer = await Beers.FirstAsync(b => b.Id == beerId);

            Beers.Remove(beer);
            await SaveChangesAsync();
        }
 public void DeleteBeer(Beer beer)
 {
     if (!Beers.Contains(beer))
     {
         throw new ArgumentException($"{beer.Name} is not a {Name} beer");
     }
     Beers.Remove(beer);
 }
示例#3
0
 /// <inheritdoc />
 public async Task DeleteBeerAsync(Beer beer)
 {
     Beers.Remove(beer);
     await SaveChangesAsync();
 }