public async Task <IActionResult> GetAllPayments() { var query = new GetAllPaymentsQuery(); var result = await _mediator.Send(query); return(Ok(result)); }
public async Task <IEnumerable <PaymentDto> > ExecuteQueryAsync(GetAllPaymentsQuery query, CancellationToken cancellationToken) { var readModels = await _msSqlConnection.QueryAsync <PaymentReadModel>( Label.Named(nameof(GetAllInvoicesQueryHandler)), cancellationToken, "SELECT * FROM [ReadModel-Payment]") .ConfigureAwait(false); return(readModels.Select(rm => rm.ToPaymentDto())); }
public PaymentController( IBankService bankService, PaymentMapper paymentMapper, AddEntityCommand addEntityCommand, GetPaymentByIdQuery getPaymentByIdQuery, PaymentViewModelBuilder paymentViewModelBuilder, GetAllPaymentsQuery getAllPaymentsQuery) { this.bankService = bankService; this.paymentMapper = paymentMapper; this.addEntityCommand = addEntityCommand; this.getPaymentByIdQuery = getPaymentByIdQuery; this.paymentViewModelBuilder = paymentViewModelBuilder; this.getAllPaymentsQuery = getAllPaymentsQuery; }
public async Task <List <PaymentDetailsResponse> > Handle(GetAllPaymentsQuery request, CancellationToken cancellationToken) { var payments = await _paymentService.GetPaymentsAsync(); return(_mapper.Map <List <PaymentDetailsResponse> >(payments)); }