public static AddFundsToClientCommand ToAddFundsToClientCommand(this AddFundsToAccountRequestModel request, int clientId) { if (request is null) { return(null); } return(new AddFundsToClientCommand() { Sum = request.Sum, Type = request.Type, ClientId = clientId }); }
public async Task <ActionResult> AddFundsToClinetAsync(int id, AddFundsToAccountRequestModel request, CancellationToken cancellationToken) { _logger.LogInformation("Call made to AddFundsToClinetAsync."); var command = request.ToAddFundsToClientCommand(id); var accountId = await _mediator.Send(command, cancellationToken); var response = new CreateAccountResponseModel { AccountId = accountId }; return(new ObjectResult(response) { StatusCode = StatusCodes.Status201Created }); }