public LastTransactionsDto GetLastTransactions(SearchTransactionsDto searchDto) { var payeeAccountid = _accountRepository.GetAll().FirstOrDefault(x => x.UserId == searchDto.UserId).Id; var transactionsList = _transactionRepository.GetAll() .Where(x => x.PayeeId == payeeAccountid) //.GroupBy(x=>x.RecipientId) //.OrderBy(x=>x.Count()) .Take(searchDto.TransactionsCount) .ToArray() .Select(x => new TransactionDto { Id = x.Id, Amount = x.Amount, Recipient = new IdNamePair { Id = x.Recipient.User.Id, Name = x.Recipient.User.Name } }); return(new LastTransactionsDto() { Transactions = transactionsList.ToArray() }); }
public IActionResult GetTransactionsList(SearchTransactionsDto searchDto) { var transactions = _transactionService.GetLastTransactions(searchDto); return(Json(JsonResultHelper.Success(transactions))); }