Ejemplo n.º 1
0
        public override async Task <DeleteCorrectionRequest> HandleAsync(DeleteCorrectionRequest command, CancellationToken cancellationToken = new CancellationToken())
        {
            var author = await _corretionRepository.GetCorrection(command.Id, cancellationToken);

            if (author != null)
            {
                await _corretionRepository.DeleteCorrection(command.Id, cancellationToken);
            }

            return(await base.HandleAsync(command, cancellationToken));
        }
Ejemplo n.º 2
0
        public override async Task <UpdateCorrectionRequest> HandleAsync(UpdateCorrectionRequest command, CancellationToken cancellationToken = new CancellationToken())
        {
            var result = await _correctionRepository.GetCorrection(command.Correction.Id, cancellationToken);

            if (result == null)
            {
                command.Result.Correction = await _correctionRepository.AddCorrection(command.Correction, cancellationToken);

                command.Result.HasAddedNew = true;
            }
            else
            {
                command.Result.Correction = await _correctionRepository.UpdateCorrection(command.Correction, cancellationToken);;
            }

            return(await base.HandleAsync(command, cancellationToken));
        }
Ejemplo n.º 3
0
 public async override Task <CorrectionModel> ExecuteAsync(GetCorrectionQuery query, CancellationToken cancellationToken = default)
 => await _correctionRepository.GetCorrection(query.Id, cancellationToken);