public async Task <Payment> UpdatePaymentAsync(Payment payment) { _ctx.Update(payment); await _ctx.SaveChangesAsync(); return(payment); }
public async Task <Staff> UpdateStaffAsync(Staff staff) { var isDeleted = await(from s in _ctx.Staff.IgnoreQueryFilters() where s.ID == staff.ID select s.IsDeleted).FirstOrDefaultAsync(); if (isDeleted) { throw new UnableToUpdateDeletedRecordsException(); } _ctx.Update(staff); await _ctx.SaveChangesAsync(); return(staff); }
public async Task <Customer> UpdateCustomerAsync(Customer customer) { var isDeleted = await(from c in _ctx.Customer.IgnoreQueryFilters() where c.ID == customer.ID select c.IsDeleted).FirstOrDefaultAsync(); if (isDeleted) { throw new UnableToUpdateDeletedRecordsException(); } _ctx.Update(customer); await _ctx.SaveChangesAsync(); return(customer); }