Пример #1
0
 public AttributeDTO ConvertAttributeToAttributeDto(Attribute attribute)
 {
     var attributeDto = new AttributeDTO
     {
         AttributeId = attribute.AttributeId,
         Name = attribute.Name,
         SortOrder = attribute.SortOrder,
         CategoryId = attribute.CategoryId,
         Category = attribute.Category,
         CategoryDescription = attribute.CategoryDescription
     };
     return attributeDto;
 }
Пример #2
0
        private static int GetOrCreateAttributeTypeDto(Attribute attribute, Dictionary<int, AttributeTypeDTO> attributeTypes)
        {
            var attributeTypeDto = new AttributeTypeDTO()
            {
                AttributeTypeId = attribute.AttributeTypeId,
                Name = attribute.AttributeTypeName,
                AllowMultipleSelections = !attribute.PreventMultipleSelection
            };

            var key = attributeTypeDto.AttributeTypeId;

            if (!attributeTypes.ContainsKey(key))
            {
                attributeTypes[key] = attributeTypeDto;
            }
            return key;
        }