public void DeleteUser(LibraryUser currentUser) { using (var uow = new library.model.Repositories.LibUnitOfWork()) { uow.LibraryUserRepository.Remove(currentUser); uow.SaveChanges(); } }
public void CompletePayment(Payable payable) { var transInfo = payable.TransactionInfo; if (transInfo.AmountToPay <= 0 || transInfo.IsPaid == true) { throw new ArgumentException("No need to pay for this transaction."); } transInfo.IsPaid = true; var bookCopy = _BookCopyService.FindById(transInfo.BookCopyId); bookCopy.IsBorrowed = false; transInfo.DateOfPayment = DateTime.Now; using (var uow = new library.model.Repositories.LibUnitOfWork()) { uow.BookCopyRepository.Update(bookCopy); uow.BookTransactionInfoRepository.Update(transInfo); uow.SaveChanges(); } }