Beispiel #1
0
        public async Task <OperationResult <IEnumerable <LoanViewModel> > > Handle(GetLoanCommand request, CancellationToken cancellationToken)
        {
            var loansDto = await _unitOfWork.Loans.FindAsync(x => x.UserId == _userId, cancellationToken : cancellationToken);

            var loans = _mapper.Map <IEnumerable <Loan>, IEnumerable <LoanViewModel> >(loansDto);

            return(new OperationResult <IEnumerable <LoanViewModel> >(nameof(HttpStatusCode.OK), true, loans));
        }
Beispiel #2
0
 public async Task <ActionResult <IEnumerable <LoanViewModel> > > GetAsync([FromQuery] GetLoanCommand command,
                                                                           CancellationToken cancellationToken = default) => Ok(await Mediator.Send(command, cancellationToken));