Пример #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);
        }
Пример #2
0
        public virtual ApiEmployeeServerResponseModel MapEntityToModel(
            Employee item)
        {
            var model = new ApiEmployeeServerResponseModel();

            model.SetProperties(item.Id,
                                item.FirstName,
                                item.IsSalesPerson,
                                item.IsShipper,
                                item.LastName);

            return(model);
        }
Пример #3
0
        public virtual ApiEmployeeServerResponseModel MapServerRequestToResponse(
            int id,
            ApiEmployeeServerRequestModel request)
        {
            var response = new ApiEmployeeServerResponseModel();

            response.SetProperties(id,
                                   request.FirstName,
                                   request.IsSalesPerson,
                                   request.IsShipper,
                                   request.LastName);
            return(response);
        }
        public virtual ApiCustomerCommunicationServerResponseModel MapEntityToModel(
            CustomerCommunication item)
        {
            var model = new ApiCustomerCommunicationServerResponseModel();

            model.SetProperties(item.Id,
                                item.CustomerId,
                                item.DateCreated,
                                item.EmployeeId,
                                item.Notes);
            if (item.CustomerIdNavigation != null)
            {
                var customerIdModel = new ApiCustomerServerResponseModel();
                customerIdModel.SetProperties(
                    item.CustomerIdNavigation.Id,
                    item.CustomerIdNavigation.Email,
                    item.CustomerIdNavigation.FirstName,
                    item.CustomerIdNavigation.LastName,
                    item.CustomerIdNavigation.Notes,
                    item.CustomerIdNavigation.Phone);

                model.SetCustomerIdNavigation(customerIdModel);
            }

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

                model.SetEmployeeIdNavigation(employeeIdModel);
            }

            return(model);
        }