public virtual ApiPipelineStepStatusServerRequestModel MapServerResponseToRequest(
            ApiPipelineStepStatusServerResponseModel response)
        {
            var request = new ApiPipelineStepStatusServerRequestModel();

            request.SetProperties(
                response.Name);
            return(request);
        }
        public void MapModelToEntity()
        {
            var mapper = new DALPipelineStepStatusMapper();
            ApiPipelineStepStatusServerRequestModel model = new ApiPipelineStepStatusServerRequestModel();

            model.SetProperties("A");
            PipelineStepStatus response = mapper.MapModelToEntity(1, model);

            response.Name.Should().Be("A");
        }
        public virtual ApiPipelineStepStatusServerResponseModel MapServerRequestToResponse(
            int id,
            ApiPipelineStepStatusServerRequestModel request)
        {
            var response = new ApiPipelineStepStatusServerResponseModel();

            response.SetProperties(id,
                                   request.Name);
            return(response);
        }
Example #4
0
        public virtual PipelineStepStatus MapModelToEntity(
            int id,
            ApiPipelineStepStatusServerRequestModel model
            )
        {
            PipelineStepStatus item = new PipelineStepStatus();

            item.SetProperties(
                id,
                model.Name);
            return(item);
        }
Example #5
0
        public virtual async Task <CreateResponse <ApiPipelineStepStatusServerResponseModel> > Create(
            ApiPipelineStepStatusServerRequestModel model)
        {
            CreateResponse <ApiPipelineStepStatusServerResponseModel> response = ValidationResponseFactory <ApiPipelineStepStatusServerResponseModel> .CreateResponse(await this.PipelineStepStatusModelValidator.ValidateCreateAsync(model));

            if (response.Success)
            {
                PipelineStepStatus record = this.DalPipelineStepStatusMapper.MapModelToEntity(default(int), model);
                record = await this.PipelineStepStatusRepository.Create(record);

                response.SetRecord(this.DalPipelineStepStatusMapper.MapEntityToModel(record));
                await this.mediator.Publish(new PipelineStepStatusCreatedNotification(response.Record));
            }

            return(response);
        }
Example #6
0
        public virtual async Task <UpdateResponse <ApiPipelineStepStatusServerResponseModel> > Update(
            int id,
            ApiPipelineStepStatusServerRequestModel model)
        {
            var validationResult = await this.PipelineStepStatusModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                PipelineStepStatus record = this.DalPipelineStepStatusMapper.MapModelToEntity(id, model);
                await this.PipelineStepStatusRepository.Update(record);

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

                ApiPipelineStepStatusServerResponseModel apiModel = this.DalPipelineStepStatusMapper.MapEntityToModel(record);
                await this.mediator.Publish(new PipelineStepStatusUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiPipelineStepStatusServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiPipelineStepStatusServerResponseModel> .UpdateResponse(validationResult));
            }
        }
        public JsonPatchDocument <ApiPipelineStepStatusServerRequestModel> CreatePatch(ApiPipelineStepStatusServerRequestModel model)
        {
            var patch = new JsonPatchDocument <ApiPipelineStepStatusServerRequestModel>();

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