Exemplo n.º 1
0
        public static DTO.AnalyticValueDriver ToDto(this Display.AnalyticValueDriver displayEntity)
        {
            var modes = new List <DTO.AnalyticValueDriverMode>();

            displayEntity.Modes.ForEach(mode => modes.Add(mode.ToDto()));

            var results = new List <DTO.AnalyticResultValueDriverGroup>();

            foreach (Display.AnalyticResultValueDriverGroup result in displayEntity.Results)
            {
                results.Add(result.ToDto());
            }

            var dto = new DTO.AnalyticValueDriver(
                displayEntity.Id,
                displayEntity.Key,
                displayEntity.IsSelected,
                displayEntity.Name,
                displayEntity.Title,
                displayEntity.Sort,
                results,
                modes);

            return(dto);
        }
Exemplo n.º 2
0
        public static Display.AnalyticValueDriver ToDisplayEntity(this DTO.AnalyticValueDriver dto)
        {
            var displayEntity = new Display.AnalyticValueDriver();

            displayEntity.Key        = dto.Key;
            displayEntity.Id         = dto.Id;
            displayEntity.Name       = dto.Name;
            displayEntity.Title      = dto.Title;
            displayEntity.Sort       = dto.Sort;
            displayEntity.IsSelected = dto.IsSelected;
            displayEntity.RunResults = dto.RunResults;
            if (dto.Modes != null)
            {
                foreach (DTO.AnalyticValueDriverMode mode in dto.Modes)
                {
                    displayEntity.Modes.Add(mode.ToDisplayEntity());
                }
            }

            if (dto.Results != null)
            {
                foreach (DTO.AnalyticResultValueDriverGroup result in dto.Results)
                {
                    displayEntity.Results.Add(result.ToDisplayEntity());
                }
            }

            return(displayEntity);
        }