public virtual ApiPipelineStepStepRequirementClientRequestModel MapServerResponseToClientRequest(
            ApiPipelineStepStepRequirementServerResponseModel response)
        {
            var request = new ApiPipelineStepStepRequirementClientRequestModel();

            request.SetProperties(
                response.Details,
                response.PipelineStepId,
                response.RequirementMet);
            return(request);
        }
        public virtual ApiPipelineStepStepRequirementServerResponseModel MapServerRequestToResponse(
            int id,
            ApiPipelineStepStepRequirementServerRequestModel request)
        {
            var response = new ApiPipelineStepStepRequirementServerResponseModel();

            response.SetProperties(id,
                                   request.Details,
                                   request.PipelineStepId,
                                   request.RequirementMet);
            return(response);
        }
        public void MapEntityToModel()
        {
            var mapper = new DALPipelineStepStepRequirementMapper();
            PipelineStepStepRequirement item = new PipelineStepStepRequirement();

            item.SetProperties(1, "A", 1, true);
            ApiPipelineStepStepRequirementServerResponseModel response = mapper.MapEntityToModel(item);

            response.Details.Should().Be("A");
            response.Id.Should().Be(1);
            response.PipelineStepId.Should().Be(1);
            response.RequirementMet.Should().Be(true);
        }
Пример #4
0
        public virtual ApiPipelineStepStepRequirementServerResponseModel MapEntityToModel(
            PipelineStepStepRequirement item)
        {
            var model = new ApiPipelineStepStepRequirementServerResponseModel();

            model.SetProperties(item.Id,
                                item.Details,
                                item.PipelineStepId,
                                item.RequirementMet);
            if (item.PipelineStepIdNavigation != null)
            {
                var pipelineStepIdModel = new ApiPipelineStepServerResponseModel();
                pipelineStepIdModel.SetProperties(
                    item.PipelineStepIdNavigation.Id,
                    item.PipelineStepIdNavigation.Name,
                    item.PipelineStepIdNavigation.PipelineStepStatusId,
                    item.PipelineStepIdNavigation.ShipperId);

                model.SetPipelineStepIdNavigation(pipelineStepIdModel);
            }

            return(model);
        }
Пример #5
0
        public virtual async Task <UpdateResponse <ApiPipelineStepStepRequirementServerResponseModel> > Update(
            int id,
            ApiPipelineStepStepRequirementServerRequestModel model)
        {
            var validationResult = await this.PipelineStepStepRequirementModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                PipelineStepStepRequirement record = this.DalPipelineStepStepRequirementMapper.MapModelToEntity(id, model);
                await this.PipelineStepStepRequirementRepository.Update(record);

                record = await this.PipelineStepStepRequirementRepository.Get(id);

                ApiPipelineStepStepRequirementServerResponseModel apiModel = this.DalPipelineStepStepRequirementMapper.MapEntityToModel(record);
                await this.mediator.Publish(new PipelineStepStepRequirementUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiPipelineStepStepRequirementServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiPipelineStepStepRequirementServerResponseModel> .UpdateResponse(validationResult));
            }
        }
Пример #6
0
 public PipelineStepStepRequirementUpdatedNotification(ApiPipelineStepStepRequirementServerResponseModel record)
 {
     this.Record = record;
 }