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