public virtual ApiPipelineClientRequestModel MapServerResponseToClientRequest(
            ApiPipelineServerResponseModel response)
        {
            var request = new ApiPipelineClientRequestModel();

            request.SetProperties(
                response.PipelineStatusId,
                response.SaleId);
            return(request);
        }
        public virtual ApiPipelineServerResponseModel MapServerRequestToResponse(
            int id,
            ApiPipelineServerRequestModel request)
        {
            var response = new ApiPipelineServerResponseModel();

            response.SetProperties(id,
                                   request.PipelineStatusId,
                                   request.SaleId);
            return(response);
        }
Exemplo n.º 3
0
        public void MapEntityToModel()
        {
            var      mapper = new DALPipelineMapper();
            Pipeline item   = new Pipeline();

            item.SetProperties(1, 1, 1);
            ApiPipelineServerResponseModel response = mapper.MapEntityToModel(item);

            response.Id.Should().Be(1);
            response.PipelineStatusId.Should().Be(1);
            response.SaleId.Should().Be(1);
        }
Exemplo n.º 4
0
        public virtual ApiPipelineServerResponseModel MapEntityToModel(
            Pipeline item)
        {
            var model = new ApiPipelineServerResponseModel();

            model.SetProperties(item.Id,
                                item.PipelineStatusId,
                                item.SaleId);
            if (item.PipelineStatusIdNavigation != null)
            {
                var pipelineStatusIdModel = new ApiPipelineStatusServerResponseModel();
                pipelineStatusIdModel.SetProperties(
                    item.PipelineStatusIdNavigation.Id,
                    item.PipelineStatusIdNavigation.Name);

                model.SetPipelineStatusIdNavigation(pipelineStatusIdModel);
            }

            return(model);
        }
Exemplo n.º 5
0
        public virtual async Task <UpdateResponse <ApiPipelineServerResponseModel> > Update(
            int id,
            ApiPipelineServerRequestModel model)
        {
            var validationResult = await this.PipelineModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                Pipeline record = this.DalPipelineMapper.MapModelToEntity(id, model);
                await this.PipelineRepository.Update(record);

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

                ApiPipelineServerResponseModel apiModel = this.DalPipelineMapper.MapEntityToModel(record);
                await this.mediator.Publish(new PipelineUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiPipelineServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiPipelineServerResponseModel> .UpdateResponse(validationResult));
            }
        }
Exemplo n.º 6
0
 public PipelineUpdatedNotification(ApiPipelineServerResponseModel record)
 {
     this.Record = record;
 }