예제 #1
0
        public async Task <Payment> UpdatePaymentAsync(Payment payment)
        {
            _ctx.Update(payment);

            await _ctx.SaveChangesAsync();

            return(payment);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }