コード例 #1
0
        public async Task DeleteBalcony(string symbol)
        {
            var balconyToDelete = Balconies.FirstOrDefault(x => x.Symbol == symbol);

            balconyToDelete.QuantityInStock = 0;
            await UpdateBalcony(balconyToDelete);
        }
コード例 #2
0
        public async Task UpdateBalcony(Balcony balcony)
        {
            var balconyToUpdate = Balconies.FirstOrDefault(x => x.Symbol == balcony.Symbol);

            balconyToUpdate.QuantityInStock = balcony.QuantityInStock;
            balconyToUpdate.Price           = balcony.Price;
            balconyToUpdate.Name            = balcony.Name;

            context.Balcony.Update(balconyToUpdate);
            await context.SaveChangesAsync();
        }
コード例 #3
0
 public async Task DeleteBalcony(string symbol)
 {
     try
     {
         var balconyToDelete = Balconies.FirstOrDefault(x => x.Symbol == symbol);
         context.Balcony.Remove(balconyToDelete);
         await context.SaveChangesAsync();
     }
     catch (Microsoft.EntityFrameworkCore.DbUpdateException)
     {
         return;
     }
 }
コード例 #4
0
 public Balcony GetBalcony(string symbol)
 {
     return(Balconies.FirstOrDefault(x => x.Symbol == symbol));
 }