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