public async Task DeleteBalcony(string symbol) { var balconyToDelete = Balconies.FirstOrDefault(x => x.Symbol == symbol); balconyToDelete.QuantityInStock = 0; await UpdateBalcony(balconyToDelete); }
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(); }
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; } }
public Balcony GetBalcony(string symbol) { return(Balconies.FirstOrDefault(x => x.Symbol == symbol)); }