public async Task <IEnumerable <Transaction> > GetUserTransactions(string userId) { ServiceValidator.IsInputStringEmptyOrNull(userId); var transactionsQuery = await this.dbContext .Transactions .Include(tr => tr.TransactionType) .Where(t => t.UserId == userId && t.IsDeleted != true) .ToListAsync(); ServiceValidator.ValueNotEqualZero(transactionsQuery.Count); return(transactionsQuery); }
public async Task <IEnumerable <Transaction> > GetTransactionByType(string transactionTypeName) { ServiceValidator.IsInputStringEmptyOrNull(transactionTypeName); ServiceValidator.CheckStringLength(transactionTypeName, 3, 20); var transactionsQuery = await this.dbContext .Transactions .Where(t => t.TransactionType.Name == transactionTypeName && t.IsDeleted != true) .ToListAsync(); ServiceValidator.ValueNotEqualZero(transactionsQuery.Count()); return(transactionsQuery); }