public long GetCount(string filter = null) { try { long count = 0; if (!String.IsNullOrWhiteSpace(filter)) { count = _attributeSetInstanceExtensionFieldApplicationService.GetCount(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver() , n => (AttributeSetInstanceExtensionFieldMetadata.Instance.FilteringPropertyAliasDictionary.ContainsKey(n) ? AttributeSetInstanceExtensionFieldMetadata.Instance.FilteringPropertyAliasDictionary[n] : n))); } else { count = _attributeSetInstanceExtensionFieldApplicationService.GetCount(AttributeSetInstanceExtensionFieldsControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs())); } return(count); } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IAttributeSetInstanceExtensionFieldStateDto> GetAll(string sort = null, string fields = null, int firstResult = 0, int maxResults = int.MaxValue, string filter = null) { try { IEnumerable <IAttributeSetInstanceExtensionFieldState> states = null; if (!String.IsNullOrWhiteSpace(filter)) { states = _attributeSetInstanceExtensionFieldApplicationService.Get(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver() , n => (AttributeSetInstanceExtensionFieldMetadata.Instance.FilteringPropertyAliasDictionary.ContainsKey(n) ? AttributeSetInstanceExtensionFieldMetadata.Instance.FilteringPropertyAliasDictionary[n] : n)) , AttributeSetInstanceExtensionFieldsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); } else { states = _attributeSetInstanceExtensionFieldApplicationService.Get(AttributeSetInstanceExtensionFieldsControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs()) , AttributeSetInstanceExtensionFieldsControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); } var stateDtos = new List <IAttributeSetInstanceExtensionFieldStateDto>(); foreach (var s in states) { var dto = s is AttributeSetInstanceExtensionFieldStateDtoWrapper ? (AttributeSetInstanceExtensionFieldStateDtoWrapper)s : new AttributeSetInstanceExtensionFieldStateDtoWrapper(s); if (String.IsNullOrWhiteSpace(fields)) { dto.AllFieldsReturned = true; } else { dto.ReturnedFieldsString = fields; } stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }