Exemplo n.º 1
0
 public IHttpActionResult Query(PaymentArchiveQuery query)
 {
     return Ok(_paymentService.QueryArchive(query));
 }
Exemplo n.º 2
0
 public IList<PaymentArchiveItemModel> QueryArchive(PaymentArchiveQuery query)
 {
     EnsureIsValid(query);
     EnsureIsSecure<PaymentArchiveQuery, UserQueryValidator>(query);
     try
     {
         var operationsByUser = DbQuery.For<UserBankOperation>()
             .FilterBy(x => x.User.Id == query.UserId);
         var operationIds =_deps.UserBankOperations
             .Select(operationsByUser, x => x.OperationId)
             .ToList();
         var paymentsQuery = DbQuery.For<PaymentArchiveItemModel>()
             .FromClientQuery(query)
             .AndFilterBy(x => operationIds.Contains(x.OperationId));
         var payments = _deps.CardPayments
             .ProjectThenQuery<PaymentArchiveItemModel>(paymentsQuery)
             .ToList();
         return payments;
     }
     catch (Exception ex)
     {
         throw new ServiceException("Can't get payments archive.", ex);
     }
 }