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