Пример #1
0
        public virtual ApiPipelineStepServerResponseModel MapEntityToModel(
            PipelineStep item)
        {
            var model = new ApiPipelineStepServerResponseModel();

            model.SetProperties(item.Id,
                                item.Name,
                                item.PipelineStepStatusId,
                                item.ShipperId);
            if (item.PipelineStepStatusIdNavigation != null)
            {
                var pipelineStepStatusIdModel = new ApiPipelineStepStatusServerResponseModel();
                pipelineStepStatusIdModel.SetProperties(
                    item.PipelineStepStatusIdNavigation.Id,
                    item.PipelineStepStatusIdNavigation.Name);

                model.SetPipelineStepStatusIdNavigation(pipelineStepStatusIdModel);
            }

            if (item.ShipperIdNavigation != null)
            {
                var shipperIdModel = new ApiEmployeeServerResponseModel();
                shipperIdModel.SetProperties(
                    item.ShipperIdNavigation.Id,
                    item.ShipperIdNavigation.FirstName,
                    item.ShipperIdNavigation.IsSalesPerson,
                    item.ShipperIdNavigation.IsShipper,
                    item.ShipperIdNavigation.LastName);

                model.SetShipperIdNavigation(shipperIdModel);
            }

            return(model);
        }
        public virtual ApiPipelineStepStatusClientRequestModel MapServerResponseToClientRequest(
            ApiPipelineStepStatusServerResponseModel response)
        {
            var request = new ApiPipelineStepStatusClientRequestModel();

            request.SetProperties(
                response.Name);
            return(request);
        }
        public virtual ApiPipelineStepStatusServerResponseModel MapServerRequestToResponse(
            int id,
            ApiPipelineStepStatusServerRequestModel request)
        {
            var response = new ApiPipelineStepStatusServerResponseModel();

            response.SetProperties(id,
                                   request.Name);
            return(response);
        }
Пример #4
0
        public virtual ApiPipelineStepStatusServerResponseModel MapEntityToModel(
            PipelineStepStatus item)
        {
            var model = new ApiPipelineStepStatusServerResponseModel();

            model.SetProperties(item.Id,
                                item.Name);

            return(model);
        }
        public void MapEntityToModel()
        {
            var mapper = new DALPipelineStepStatusMapper();
            PipelineStepStatus item = new PipelineStepStatus();

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

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
Пример #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));
            }
        }
Пример #7
0
 public PipelineStepStatusUpdatedNotification(ApiPipelineStepStatusServerResponseModel record)
 {
     this.Record = record;
 }
 public void SetPipelineStepStatusIdNavigation(ApiPipelineStepStatusServerResponseModel value)
 {
     this.PipelineStepStatusIdNavigation = value;
 }