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