public async Task UpdateShelf(Shelf shelf)
        {
            var shelfToUpdate = Shelves.FirstOrDefault(x => x.Symbol == shelf.Symbol);

            shelfToUpdate.QuantityInStock = shelf.QuantityInStock;
            shelfToUpdate.Price           = shelf.Price;
            shelfToUpdate.Name            = shelf.Name;

            context.Shelf.Update(shelfToUpdate);
            await context.SaveChangesAsync();
        }
Example #2
0
 public async Task UpdateShelf(Shelf shelf)
 {
     context.Shelf.Update(shelf);
     await context.SaveChangesAsync();
 }
Example #3
0
 public async Task CreateShelf(Shelf shelf)
 {
     context.Shelf.Add(shelf);
     await context.SaveChangesAsync();
 }