예제 #1
0
        public virtual ApiPipelineStepDestinationServerRequestModel MapServerResponseToRequest(
            ApiPipelineStepDestinationServerResponseModel response)
        {
            var request = new ApiPipelineStepDestinationServerRequestModel();

            request.SetProperties(
                response.DestinationId,
                response.PipelineStepId);
            return(request);
        }
예제 #2
0
        public virtual ApiPipelineStepDestinationServerResponseModel MapServerRequestToResponse(
            int id,
            ApiPipelineStepDestinationServerRequestModel request)
        {
            var response = new ApiPipelineStepDestinationServerResponseModel();

            response.SetProperties(id,
                                   request.DestinationId,
                                   request.PipelineStepId);
            return(response);
        }
        public void MapModelToEntity()
        {
            var mapper = new DALPipelineStepDestinationMapper();
            ApiPipelineStepDestinationServerRequestModel model = new ApiPipelineStepDestinationServerRequestModel();

            model.SetProperties(1, 1);
            PipelineStepDestination response = mapper.MapModelToEntity(1, model);

            response.DestinationId.Should().Be(1);
            response.PipelineStepId.Should().Be(1);
        }
        public virtual PipelineStepDestination MapModelToEntity(
            int id,
            ApiPipelineStepDestinationServerRequestModel model
            )
        {
            PipelineStepDestination item = new PipelineStepDestination();

            item.SetProperties(
                id,
                model.DestinationId,
                model.PipelineStepId);
            return(item);
        }
        public virtual async Task <CreateResponse <ApiPipelineStepDestinationServerResponseModel> > Create(
            ApiPipelineStepDestinationServerRequestModel model)
        {
            CreateResponse <ApiPipelineStepDestinationServerResponseModel> response = ValidationResponseFactory <ApiPipelineStepDestinationServerResponseModel> .CreateResponse(await this.PipelineStepDestinationModelValidator.ValidateCreateAsync(model));

            if (response.Success)
            {
                PipelineStepDestination record = this.DalPipelineStepDestinationMapper.MapModelToEntity(default(int), model);
                record = await this.PipelineStepDestinationRepository.Create(record);

                response.SetRecord(this.DalPipelineStepDestinationMapper.MapEntityToModel(record));
                await this.mediator.Publish(new PipelineStepDestinationCreatedNotification(response.Record));
            }

            return(response);
        }
        public virtual async Task <UpdateResponse <ApiPipelineStepDestinationServerResponseModel> > Update(
            int id,
            ApiPipelineStepDestinationServerRequestModel model)
        {
            var validationResult = await this.PipelineStepDestinationModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                PipelineStepDestination record = this.DalPipelineStepDestinationMapper.MapModelToEntity(id, model);
                await this.PipelineStepDestinationRepository.Update(record);

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

                ApiPipelineStepDestinationServerResponseModel apiModel = this.DalPipelineStepDestinationMapper.MapEntityToModel(record);
                await this.mediator.Publish(new PipelineStepDestinationUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiPipelineStepDestinationServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiPipelineStepDestinationServerResponseModel> .UpdateResponse(validationResult));
            }
        }
예제 #7
0
        public JsonPatchDocument <ApiPipelineStepDestinationServerRequestModel> CreatePatch(ApiPipelineStepDestinationServerRequestModel model)
        {
            var patch = new JsonPatchDocument <ApiPipelineStepDestinationServerRequestModel>();

            patch.Replace(x => x.DestinationId, model.DestinationId);
            patch.Replace(x => x.PipelineStepId, model.PipelineStepId);
            return(patch);
        }