Ejemplo n.º 1
0
        public async Task <UpdateStepArtifactResponse> Put(UpdateStepArtifactRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            var existingStepArtifact =
                await stepRepository.GetStepArtifact(step.Id, request.ArtifactName);

            if (existingStepArtifact == null)
            {
                throw Err.StepArtifactNotFound(request.ArtifactName);
            }

            var stepArtifact = request.ConvertTo <StepArtifact>();

            stepArtifact.StepId = step.Id;
            stepArtifact.Id     = existingStepArtifact.Id;

            await stepRepository.UpdateStepArtifact(stepArtifact);

            return(new UpdateStepArtifactResponse());
        }