Ejemplo n.º 1
0
        public JsonPatchDocument <ApiPipelineStepNoteServerRequestModel> CreatePatch(ApiPipelineStepNoteServerRequestModel model)
        {
            var patch = new JsonPatchDocument <ApiPipelineStepNoteServerRequestModel>();

            patch.Replace(x => x.EmployeeId, model.EmployeeId);
            patch.Replace(x => x.Note, model.Note);
            patch.Replace(x => x.PipelineStepId, model.PipelineStepId);
            return(patch);
        }
Ejemplo n.º 2
0
        public virtual ApiPipelineStepNoteServerRequestModel MapServerResponseToRequest(
            ApiPipelineStepNoteServerResponseModel response)
        {
            var request = new ApiPipelineStepNoteServerRequestModel();

            request.SetProperties(
                response.EmployeeId,
                response.Note,
                response.PipelineStepId);
            return(request);
        }
        public void MapModelToEntity()
        {
            var mapper = new DALPipelineStepNoteMapper();
            ApiPipelineStepNoteServerRequestModel model = new ApiPipelineStepNoteServerRequestModel();

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

            response.EmployeeId.Should().Be(1);
            response.Note.Should().Be("A");
            response.PipelineStepId.Should().Be(1);
        }
Ejemplo n.º 4
0
        public virtual ApiPipelineStepNoteServerResponseModel MapServerRequestToResponse(
            int id,
            ApiPipelineStepNoteServerRequestModel request)
        {
            var response = new ApiPipelineStepNoteServerResponseModel();

            response.SetProperties(id,
                                   request.EmployeeId,
                                   request.Note,
                                   request.PipelineStepId);
            return(response);
        }
Ejemplo n.º 5
0
        public virtual PipelineStepNote MapModelToEntity(
            int id,
            ApiPipelineStepNoteServerRequestModel model
            )
        {
            PipelineStepNote item = new PipelineStepNote();

            item.SetProperties(
                id,
                model.EmployeeId,
                model.Note,
                model.PipelineStepId);
            return(item);
        }
Ejemplo n.º 6
0
        public virtual async Task <CreateResponse <ApiPipelineStepNoteServerResponseModel> > Create(
            ApiPipelineStepNoteServerRequestModel model)
        {
            CreateResponse <ApiPipelineStepNoteServerResponseModel> response = ValidationResponseFactory <ApiPipelineStepNoteServerResponseModel> .CreateResponse(await this.PipelineStepNoteModelValidator.ValidateCreateAsync(model));

            if (response.Success)
            {
                PipelineStepNote record = this.DalPipelineStepNoteMapper.MapModelToEntity(default(int), model);
                record = await this.PipelineStepNoteRepository.Create(record);

                response.SetRecord(this.DalPipelineStepNoteMapper.MapEntityToModel(record));
                await this.mediator.Publish(new PipelineStepNoteCreatedNotification(response.Record));
            }

            return(response);
        }
Ejemplo n.º 7
0
        public virtual async Task <UpdateResponse <ApiPipelineStepNoteServerResponseModel> > Update(
            int id,
            ApiPipelineStepNoteServerRequestModel model)
        {
            var validationResult = await this.PipelineStepNoteModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                PipelineStepNote record = this.DalPipelineStepNoteMapper.MapModelToEntity(id, model);
                await this.PipelineStepNoteRepository.Update(record);

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

                ApiPipelineStepNoteServerResponseModel apiModel = this.DalPipelineStepNoteMapper.MapEntityToModel(record);
                await this.mediator.Publish(new PipelineStepNoteUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiPipelineStepNoteServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiPipelineStepNoteServerResponseModel> .UpdateResponse(validationResult));
            }
        }