Exemplo n.º 1
0
        public static List <DataCollectionViewModel> ConvertToDomainModel(DataCollectionsResponseDto source)
        {
            if (source == null)
            {
                return(new List <DataCollectionViewModel>());
            }
            if (source.DataCollections.Count() == 0)
            {
                return(new List <DataCollectionViewModel>());
            }

            var list = new List <DataCollectionViewModel>(source.DataCollections.Count());

            foreach (DataCollectionsResponseDto.DataCollectionDto dataCollectionDto in source.DataCollections)
            {
                list.Add(new DataCollectionViewModel()
                {
                    DataCollectionId = dataCollectionDto.DataCollectionId,
                    MatterType       = source.LinkedMatterTypes.Single(x => x.MatterTypeId == dataCollectionDto.Links.MatterTypeId).Name,
                    Description      = dataCollectionDto.Description,
                    Label            = dataCollectionDto.Label
                });
            }

            return(list);
        }
Exemplo n.º 2
0
        public static IEnumerable <DataCollectionLookup> ConvertToDomainModelForLookup(DataCollectionsResponseDto source)
        {
            if (source.DataCollections.Count == 0)
            {
                return(new List <DataCollectionLookup>());
            }
            var list = new List <DataCollectionLookup>(source.DataCollections.Count);

            foreach (var dto in source.DataCollections)
            {
                list.Add(new DataCollectionLookup()
                {
                    DataCollectionId = dto.DataCollectionId,
                    MatterTypeId     = dto.Links.MatterTypeId,
                    Label            = dto.Label
                });
            }

            return(list);
        }