/// <summary> /// Executes the action of this command. /// </summary> /// <param name="request">The command parameters.</param> /// <param name="cancellationToken">Token to cancel the request.</param> /// <returns>A task representing an operation to get the result of this command.</returns> public async Task <SubmitSolutionForReviewCommandResult> Handle( SubmitSolutionForReviewCommand request, CancellationToken cancellationToken) { Solution solution = await solutionReader.ByIdAsync(request.SolutionId, cancellationToken); ValidationResult validationResult = new SubmitSolutionForReviewValidator(solution).Validate(); SubmitSolutionForReviewCommandResult result = new SubmitSolutionForReviewCommandResult(validationResult.Errors); return(result); }
/// <summary> /// Executes the action of this command. /// </summary> /// <param name="request">The command parameters.</param> /// <param name="cancellationToken">Token to cancel the request.</param> /// <returns>A task representing an operation to get the result of this command.</returns> public async Task <SubmitSolutionForReviewCommandResult> Handle(SubmitSolutionForReviewCommand request, CancellationToken cancellationToken) { Solution solution = await _solutionReader.ByIdAsync(request.SolutionId, cancellationToken).ConfigureAwait(false); ValidationResult validationResult = new SubmitSolutionForReviewValidator(solution).Validate(); SubmitSolutionForReviewCommandResult result = new SubmitSolutionForReviewCommandResult(validationResult.Errors); if (result.IsSuccess) { await _solutionRepository.UpdateSupplierStatusAsync(new UpdateSolutionSupplierStatusRequest(solution.Id, SupplierStatus.AuthorityReview.Id), cancellationToken) .ConfigureAwait(false); } return(result); }
private async Task <Solution> GetSolution(UpdateSolutionFeaturesCommand request, CancellationToken cancellationToken) => await _solutionReader.ByIdAsync(request.SolutionId, cancellationToken).ConfigureAwait(false);
private async Task <Solution> GetSolution(UpdateSolutionSummaryCommand request, CancellationToken cancellationToken) => await solutionReader.ByIdAsync(request.SolutionId, cancellationToken);
/// <summary> /// Gets the query result. /// </summary> /// <param name="request">The query parameters.</param> /// <param name="cancellationToken">Token to cancel the request.</param> /// <returns>A task representing an operation to get the result of this query.</returns> public async Task <ISolution> Handle(GetSolutionByIdQuery request, CancellationToken cancellationToken) => mapper.Map <ISolution>(await solutionReader.ByIdAsync(request.Id, cancellationToken));
/// <summary> /// Gets the query result. /// </summary> /// <param name="request">The query parameters.</param> /// <param name="cancellationToken">Token to cancel the request.</param> /// <returns>A task representing an operation to get the result of this query.</returns> public async Task <ISolution> Handle(GetSolutionByIdQuery request, CancellationToken cancellationToken) => _mapper.Map <ISolution>(await _solutionReader.ByIdAsync(request.Id, cancellationToken).ConfigureAwait(false));