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