Exemple #1
0
 public IEnumerable <UserRoleMvoStateDto> GetAll(string sort = null, string fields = null, int firstResult = 0, int maxResults = int.MaxValue, string filter = null)
 {
     try {
         IEnumerable <IUserRoleMvoState> states = null;
         if (!String.IsNullOrWhiteSpace(filter))
         {
             states = _userRoleMvoApplicationService.Get(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver())
                                                         , UserRoleMvosControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults);
         }
         else
         {
             states = _userRoleMvoApplicationService.Get(UserRoleMvosControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs())
                                                         , UserRoleMvosControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults);
         }
         var stateDtos = new List <UserRoleMvoStateDto>();
         foreach (var s in states)
         {
             var dto = s is UserRoleMvoStateDto ? (UserRoleMvoStateDto)s : new UserRoleMvoStateDto((UserRoleMvoState)s);
             if (String.IsNullOrWhiteSpace(fields))
             {
                 dto.AllFieldsReturned = true;
             }
             else
             {
                 dto.ReturnedFieldsString = fields;
             }
             stateDtos.Add(dto);
         }
         return(stateDtos);
     } catch (Exception ex) { var response = UserRoleMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Exemple #2
0
 public IUserRoleMvoStateEvent GetStateEvent(string id, long version)
 {
     try {
         var idObj = UserRoleMvosControllerUtils.ParseIdString(id);
         return(_userRoleMvoApplicationService.GetStateEvent(idObj, version));
     } catch (Exception ex) { var response = UserRoleMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Exemple #3
0
 public void Patch(string id, [FromBody] MergePatchUserRoleMvoDto value)
 {
     try {
         UserRoleMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
         _userRoleMvoApplicationService.When(value as IMergePatchUserRoleMvo);
     } catch (Exception ex) { var response = UserRoleMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Exemple #4
0
 public void Delete(string id, string commandId, string version, string requesterId = default(string))
 {
     try {
         var value = new DeleteUserRoleMvoDto();
         value.CommandId   = commandId;
         value.RequesterId = requesterId;
         value.UserVersion = (long)Convert.ChangeType(version, typeof(long));
         UserRoleMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
         _userRoleMvoApplicationService.When(value as IDeleteUserRoleMvo);
     } catch (Exception ex) { var response = UserRoleMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Exemple #5
0
 public IEnumerable <PropertyMetadata> GetMetadataFilteringFields()
 {
     try {
         var filtering = new List <PropertyMetadata>();
         foreach (var p in UserRoleMvoMetadata.Instance.Properties)
         {
             if (p.IsFilteringProperty)
             {
                 filtering.Add(p);
             }
         }
         return(filtering);
     } catch (Exception ex) { var response = UserRoleMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Exemple #6
0
 public long GetCount(string filter = null)
 {
     try
     {
         long count = 0;
         if (!String.IsNullOrWhiteSpace(filter))
         {
             count = _userRoleMvoApplicationService.GetCount(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver()));
         }
         else
         {
             count = _userRoleMvoApplicationService.GetCount(UserRoleMvosControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs()));
         }
         return(count);
     } catch (Exception ex) { var response = UserRoleMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Exemple #7
0
 public UserRoleMvoStateDto Get(string id, string fields = null)
 {
     try {
         var idObj = UserRoleMvosControllerUtils.ParseIdString(id);
         var state = (UserRoleMvoState)_userRoleMvoApplicationService.Get(idObj);
         if (state == null)
         {
             return(null);
         }
         var stateDto = new UserRoleMvoStateDto(state);
         if (String.IsNullOrWhiteSpace(fields))
         {
             stateDto.AllFieldsReturned = true;
         }
         else
         {
             stateDto.ReturnedFieldsString = fields;
         }
         return(stateDto);
     } catch (Exception ex) { var response = UserRoleMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Exemple #8
0
 public Type ResolveTypeByPropertyName(string propertyName)
 {
     return(UserRoleMvosControllerUtils.GetFilterPropertyType(propertyName));
 }