public virtual ApiOtherTransportClientRequestModel MapServerResponseToClientRequest(
            ApiOtherTransportServerResponseModel response)
        {
            var request = new ApiOtherTransportClientRequestModel();

            request.SetProperties(
                response.HandlerId,
                response.PipelineStepId);
            return(request);
        }
        public virtual ApiOtherTransportServerResponseModel MapServerRequestToResponse(
            int id,
            ApiOtherTransportServerRequestModel request)
        {
            var response = new ApiOtherTransportServerResponseModel();

            response.SetProperties(id,
                                   request.HandlerId,
                                   request.PipelineStepId);
            return(response);
        }
예제 #3
0
        public void MapEntityToModel()
        {
            var            mapper = new DALOtherTransportMapper();
            OtherTransport item   = new OtherTransport();

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

            response.HandlerId.Should().Be(1);
            response.Id.Should().Be(1);
            response.PipelineStepId.Should().Be(1);
        }
예제 #4
0
        public virtual async Task <UpdateResponse <ApiOtherTransportServerResponseModel> > Update(
            int id,
            ApiOtherTransportServerRequestModel model)
        {
            var validationResult = await this.OtherTransportModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                OtherTransport record = this.DalOtherTransportMapper.MapModelToEntity(id, model);
                await this.OtherTransportRepository.Update(record);

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

                ApiOtherTransportServerResponseModel apiModel = this.DalOtherTransportMapper.MapEntityToModel(record);
                await this.mediator.Publish(new OtherTransportUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiOtherTransportServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiOtherTransportServerResponseModel> .UpdateResponse(validationResult));
            }
        }
예제 #5
0
        public virtual ApiOtherTransportServerResponseModel MapEntityToModel(
            OtherTransport item)
        {
            var model = new ApiOtherTransportServerResponseModel();

            model.SetProperties(item.Id,
                                item.HandlerId,
                                item.PipelineStepId);
            if (item.HandlerIdNavigation != null)
            {
                var handlerIdModel = new ApiHandlerServerResponseModel();
                handlerIdModel.SetProperties(
                    item.HandlerIdNavigation.Id,
                    item.HandlerIdNavigation.CountryId,
                    item.HandlerIdNavigation.Email,
                    item.HandlerIdNavigation.FirstName,
                    item.HandlerIdNavigation.LastName,
                    item.HandlerIdNavigation.Phone);

                model.SetHandlerIdNavigation(handlerIdModel);
            }

            if (item.PipelineStepIdNavigation != null)
            {
                var pipelineStepIdModel = new ApiPipelineStepServerResponseModel();
                pipelineStepIdModel.SetProperties(
                    item.PipelineStepIdNavigation.Id,
                    item.PipelineStepIdNavigation.Name,
                    item.PipelineStepIdNavigation.PipelineStepStatusId,
                    item.PipelineStepIdNavigation.ShipperId);

                model.SetPipelineStepIdNavigation(pipelineStepIdModel);
            }

            return(model);
        }
예제 #6
0
 public OtherTransportUpdatedNotification(ApiOtherTransportServerResponseModel record)
 {
     this.Record = record;
 }