Esempio n. 1
0
        public virtual ApiChainServerResponseModel MapEntityToModel(
            Chain item)
        {
            var model = new ApiChainServerResponseModel();

            model.SetProperties(item.Id,
                                item.ChainStatusId,
                                item.ExternalId,
                                item.Name,
                                item.TeamId);
            if (item.ChainStatusIdNavigation != null)
            {
                var chainStatusIdModel = new ApiChainStatusServerResponseModel();
                chainStatusIdModel.SetProperties(
                    item.ChainStatusIdNavigation.Id,
                    item.ChainStatusIdNavigation.Name);

                model.SetChainStatusIdNavigation(chainStatusIdModel);
            }

            if (item.TeamIdNavigation != null)
            {
                var teamIdModel = new ApiTeamServerResponseModel();
                teamIdModel.SetProperties(
                    item.TeamIdNavigation.Id,
                    item.TeamIdNavigation.Name,
                    item.TeamIdNavigation.OrganizationId);

                model.SetTeamIdNavigation(teamIdModel);
            }

            return(model);
        }
Esempio n. 2
0
        public virtual ApiLinkServerResponseModel MapEntityToModel(
            Link item)
        {
            var model = new ApiLinkServerResponseModel();

            model.SetProperties(item.Id,
                                item.AssignedMachineId,
                                item.ChainId,
                                item.DateCompleted,
                                item.DateStarted,
                                item.DynamicParameters,
                                item.ExternalId,
                                item.LinkStatusId,
                                item.Name,
                                item.Order,
                                item.Response,
                                item.StaticParameters,
                                item.TimeoutInSeconds);
            if (item.AssignedMachineIdNavigation != null)
            {
                var assignedMachineIdModel = new ApiMachineServerResponseModel();
                assignedMachineIdModel.SetProperties(
                    item.AssignedMachineIdNavigation.Id,
                    item.AssignedMachineIdNavigation.Description,
                    item.AssignedMachineIdNavigation.JwtKey,
                    item.AssignedMachineIdNavigation.LastIpAddress,
                    item.AssignedMachineIdNavigation.MachineGuid,
                    item.AssignedMachineIdNavigation.Name);

                model.SetAssignedMachineIdNavigation(assignedMachineIdModel);
            }

            if (item.ChainIdNavigation != null)
            {
                var chainIdModel = new ApiChainServerResponseModel();
                chainIdModel.SetProperties(
                    item.ChainIdNavigation.Id,
                    item.ChainIdNavigation.ChainStatusId,
                    item.ChainIdNavigation.ExternalId,
                    item.ChainIdNavigation.Name,
                    item.ChainIdNavigation.TeamId);

                model.SetChainIdNavigation(chainIdModel);
            }

            if (item.LinkStatusIdNavigation != null)
            {
                var linkStatusIdModel = new ApiLinkStatusServerResponseModel();
                linkStatusIdModel.SetProperties(
                    item.LinkStatusIdNavigation.Id,
                    item.LinkStatusIdNavigation.Name);

                model.SetLinkStatusIdNavigation(linkStatusIdModel);
            }

            return(model);
        }
Esempio n. 3
0
        public virtual ApiChainServerResponseModel MapServerRequestToResponse(
            int id,
            ApiChainServerRequestModel request)
        {
            var response = new ApiChainServerResponseModel();

            response.SetProperties(id,
                                   request.ChainStatusId,
                                   request.ExternalId,
                                   request.Name,
                                   request.TeamId);
            return(response);
        }
Esempio n. 4
0
        public virtual ApiClaspServerResponseModel MapEntityToModel(
            Clasp item)
        {
            var model = new ApiClaspServerResponseModel();

            model.SetProperties(item.Id,
                                item.NextChainId,
                                item.PreviousChainId);
            if (item.NextChainIdNavigation != null)
            {
                var nextChainIdModel = new ApiChainServerResponseModel();
                nextChainIdModel.SetProperties(
                    item.NextChainIdNavigation.Id,
                    item.NextChainIdNavigation.ChainStatusId,
                    item.NextChainIdNavigation.ExternalId,
                    item.NextChainIdNavigation.Name,
                    item.NextChainIdNavigation.TeamId);

                model.SetNextChainIdNavigation(nextChainIdModel);
            }

            if (item.PreviousChainIdNavigation != null)
            {
                var previousChainIdModel = new ApiChainServerResponseModel();
                previousChainIdModel.SetProperties(
                    item.PreviousChainIdNavigation.Id,
                    item.PreviousChainIdNavigation.ChainStatusId,
                    item.PreviousChainIdNavigation.ExternalId,
                    item.PreviousChainIdNavigation.Name,
                    item.PreviousChainIdNavigation.TeamId);

                model.SetPreviousChainIdNavigation(previousChainIdModel);
            }

            return(model);
        }