public async Task <IActionResult> UpdateSample(Guid sampleId, SampleForUpdateDto sample)
        {
            var sampleFromRepo = await _sampleRepository.GetSampleAsync(sampleId);

            if (sampleFromRepo == null)
            {
                return(NotFound());
            }

            var validationResults = new SampleForUpdateDtoValidator().Validate(sample);

            validationResults.AddToModelState(ModelState, null);

            if (!ModelState.IsValid)
            {
                return(BadRequest(new ValidationProblemDetails(ModelState)));
                //return ValidationProblem();
            }

            _mapper.Map(sample, sampleFromRepo);
            _sampleRepository.UpdateSample(sampleFromRepo);

            await _sampleRepository.SaveAsync();

            return(NoContent());
        }
        public async Task <IActionResult> UpdateSample(Guid sampleId, SampleForUpdateDto sample)
        {
            // add error handling
            var command = new UpdateSampleCommand(sampleId, sample);
            await _mediator.Send(command);

            return(NoContent());
        }
 public UpdateSampleCommand(Guid sample, SampleForUpdateDto sampleToUpdate)
 {
     SampleId       = sample;
     SampleToUpdate = sampleToUpdate;
 }