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