예제 #1
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));
        }
예제 #2
0
        public override async Task <AddCorrectionRequest> HandleAsync(AddCorrectionRequest command, CancellationToken cancellationToken = new CancellationToken())
        {
            command.Result = await _correctionRepository.AddCorrection(command.Correction, cancellationToken);

            return(await base.HandleAsync(command, cancellationToken));
        }