BankOperationRepository.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. 
  2. namespace Repository;
  3. public class BankOperationRepository : RepositoryBase<BankOperation>, IBankOperationRepository
  4. {
  5. public BankOperationRepository(RepositoryContext repositoryContext)
  6. :base(repositoryContext)
  7. {
  8. }
  9. public IQueryable<BankOperation> GetAll()
  10. {
  11. return FindAll().OrderBy(x => x.DocDate);
  12. }
  13. public IQueryable<BankOperation> GetAllConfirmed(Guid accountId, Guid businessId)
  14. {
  15. if (accountId == Guid.Empty)
  16. return FindByCondition(x => x.Status == "CONFIRMED");
  17. return FindByCondition(x => x.Status == "CONFIRMED" && x.BankAccountId == accountId && x.BusinessId == businessId);
  18. }
  19. public IQueryable<BankOperation> GetAllNew(Guid accountId, Guid businessId)
  20. {
  21. if(accountId == Guid.Empty)
  22. return FindByCondition(x => x.Status == "NEW");
  23. return FindByCondition(x => x.Status == "NEW" && x.BankAccountId == accountId && x.BusinessId == businessId);
  24. }
  25. public IQueryable<BankOperation> GetByBankAccountId(Guid bankAccountId)
  26. {
  27. return FindByCondition(x => x.BankAccountId == bankAccountId);
  28. }
  29. }