async Task IOrderRepository.DeleteAsync(int id) { var order = await _db.Order.FirstOrDefaultAsync(_order => _order.Id == id); if (order != null) { _db.Order.Remove(order); await _db.SaveChangesAsync(); } }
async Task <bool> ICustomerRepository.DeleteAsync(int id) { bool result = false; var customer = await _db.Customer.FirstOrDefaultAsync(_customer => _customer.Id == id); if (customer != null) { _db.Customer.Remove(customer); result = await _db.SaveChangesAsync() > 0; } return(result); }
async public Task <Product> InsertAsync(Product product) { var current = await _db.Product.FirstOrDefaultAsync(_product => _product.Id == product.Id); if (current == null) { _db.Product.Add(product); } await _db.SaveChangesAsync(); return(product); }