Example #1
0
        public static IEnumerable <AttributeSetInstanceStateDto> ToAttributeSetInstanceStateDtoCollection(IEnumerable <string> ids)
        {
            var states = new List <AttributeSetInstanceStateDto>();

            foreach (var id in ids)
            {
                var dto = new AttributeSetInstanceStateDto();
                dto.AttributeSetInstanceId = id;
                states.Add(dto);
            }
            return(states);
        }
 private static void MapExtensionProperties(AttributeSetInstanceStateDto state, JObject dynamicObject, IDictionary <string, string> propertyFieldDictionary, string nameFormat)
 {
     foreach (var p in propertyFieldDictionary)
     {
         var propertyName = (nameFormat == null) ? p.Key : String.Format(nameFormat, p.Key);
         var fieldName    = (nameFormat == null) ? p.Value : String.Format(nameFormat, p.Value);
         var pVal         = Dynamic.InvokeGet(state, fieldName);
         if (pVal != null)
         {
             Dynamic.InvokeSet(dynamicObject, propertyName, pVal);
         }
     }
 }
Example #3
0
 public JObject Get(string id, string fields = null)
 {
     try {
         var idObj = id;
         var state = (AttributeSetInstanceState)_attributeSetInstanceApplicationService.Get(idObj);
         if (state == null)
         {
             return(null);
         }
         var stateDto = new AttributeSetInstanceStateDto(state);
         if (String.IsNullOrWhiteSpace(fields))
         {
             stateDto.AllFieldsReturned = true;
         }
         else
         {
             stateDto.ReturnedFieldsString = fields;
         }
         return(_attributeSetInstanceDtoJObjectMapper.MapState(stateDto));
     } catch (Exception ex) { var response = AttributeSetInstancesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
        protected override void MapExtensionProperties(AttributeSetInstanceStateDto state, JObject dynamicObject)
        {
            var pDic = AttributeSetService.GetExtensionPropertyFieldDictionary(state.AttributeSetId);

            MapExtensionProperties(state, dynamicObject, pDic, null);
        }
Example #5
0
 public static CreateAttributeSetInstanceDto ToCreateAttributeSetInstance(this AttributeSetInstanceStateDto state)
 {
     return(state.ToCreateAttributeSetInstance <CreateAttributeSetInstanceDto>());
 }
Example #6
0
 public static MergePatchAttributeSetInstanceDto ToMergePatchAttributeSetInstance(this AttributeSetInstanceStateDto state)
 {
     return(state.ToMergePatchAttributeSetInstance <MergePatchAttributeSetInstanceDto>());
 }
Example #7
0
 public static DeleteAttributeSetInstanceDto ToDeleteAttributeSetInstance(this AttributeSetInstanceStateDto state)
 {
     return(state.ToDeleteAttributeSetInstance <DeleteAttributeSetInstanceDto>());
 }
Example #8
0
 public static IAttributeSetInstanceCommand ToCreateOrMergePatchAttributeSetInstance(this AttributeSetInstanceStateDto state)
 {
     return(state.ToCreateOrMergePatchAttributeSetInstance <CreateAttributeSetInstanceDto, MergePatchAttributeSetInstanceDto>());
 }