public IEnumerable <Payable> GetReturnedBooksPayables() { ICollection <Payable> Payables = new List <Payable>(); using (var bookCopyRepo = new BookCopyRepository()) using (var transRepo = new BookTransactionInfoRepository()) using (var userRepo = new LibraryUserRepository()) { var trans = transRepo.GetReturnedBooksPayableTransactions(); foreach (var tran in trans) { Payable p = new Payable(); p.BookCopy = bookCopyRepo.FindById(tran.BookCopyId); p.TransactionInfo = tran; p.LibraryUserId = tran.LibraryUserId; p.AmountToPay = tran.AmountToPay; p.BookInvolved = _BookCopyService.GetBookInfo(tran.BookCopyId).BookTitle; p.UserInvolved = userRepo.FindById(tran.LibraryUserId).Fullname; Payables.Add(p); } return(Payables); } }
public LibraryUser FindById(object id) { using (var userRepo = new LibraryUserRepository()) { return(userRepo.FindById(id)); } }