public IEnumerable <IOrderItemShipGroupAssociationMvoStateDto> GetAll(string sort = null, string fields = null, int firstResult = 0, int maxResults = int.MaxValue, string filter = null)
 {
     try {
         IEnumerable <IOrderItemShipGroupAssociationMvoState> states = null;
         if (!String.IsNullOrWhiteSpace(filter))
         {
             states = _orderItemShipGroupAssociationMvoApplicationService.Get(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver()
                                                                                                      , n => (OrderItemShipGroupAssociationMvoMetadata.Instance.FilteringPropertyAliasDictionary.ContainsKey(n) ? OrderItemShipGroupAssociationMvoMetadata.Instance.FilteringPropertyAliasDictionary[n] : n))
                                                                              , OrderItemShipGroupAssociationMvosControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults);
         }
         else
         {
             states = _orderItemShipGroupAssociationMvoApplicationService.Get(OrderItemShipGroupAssociationMvosControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs())
                                                                              , OrderItemShipGroupAssociationMvosControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults);
         }
         var stateDtos = new List <IOrderItemShipGroupAssociationMvoStateDto>();
         foreach (var s in states)
         {
             var dto = s is OrderItemShipGroupAssociationMvoStateDtoWrapper ? (OrderItemShipGroupAssociationMvoStateDtoWrapper)s : new OrderItemShipGroupAssociationMvoStateDtoWrapper(s);
             if (String.IsNullOrWhiteSpace(fields))
             {
                 dto.AllFieldsReturned = true;
             }
             else
             {
                 dto.ReturnedFieldsString = fields;
             }
             stateDtos.Add(dto);
         }
         return(stateDtos);
     } catch (Exception ex) { var response = OrderItemShipGroupAssociationMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
 public void Patch(string id, [FromBody] MergePatchOrderItemShipGroupAssociationMvoDto value)
 {
     try {
         OrderItemShipGroupAssociationMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
         _orderItemShipGroupAssociationMvoApplicationService.When(value as IMergePatchOrderItemShipGroupAssociationMvo);
     } catch (Exception ex) { var response = OrderItemShipGroupAssociationMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
 public OrderItemShipGroupAssociationMvoStateCreatedOrMergePatchedOrDeletedDto GetStateEvent(string id, long version)
 {
     try {
         var idObj = OrderItemShipGroupAssociationMvosControllerUtils.ParseIdString(id);
         var conv  = new OrderItemShipGroupAssociationMvoStateEventDtoConverter();
         var se    = _orderItemShipGroupAssociationMvoApplicationService.GetEvent(idObj, version);
         return(se == null ? null : conv.ToOrderItemShipGroupAssociationMvoStateEventDto(se));
     } catch (Exception ex) { var response = OrderItemShipGroupAssociationMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
 public void Delete(string id, string commandId, string version, string requesterId = default(string))
 {
     try {
         var value = new DeleteOrderItemShipGroupAssociationMvoDto();
         value.CommandId    = commandId;
         value.RequesterId  = requesterId;
         value.OrderVersion = (long)Convert.ChangeType(version, typeof(long));
         OrderItemShipGroupAssociationMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
         _orderItemShipGroupAssociationMvoApplicationService.When(value as IDeleteOrderItemShipGroupAssociationMvo);
     } catch (Exception ex) { var response = OrderItemShipGroupAssociationMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
        public HttpResponseMessage Post([FromBody] CreateOrderItemShipGroupAssociationMvoDto value)
        {
            try {
                if (value.OrderItemShipGroupAssociationId == default(OrderItemShipGroupAssociationId))
                {
                    throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "OrderItemShipGroupAssociationMvo");
                }
                _orderItemShipGroupAssociationMvoApplicationService.When(value as ICreateOrderItemShipGroupAssociationMvo);
                var idObj = value.OrderItemShipGroupAssociationId;

                return(Request.CreateResponse <OrderItemShipGroupAssociationId>(HttpStatusCode.Created, idObj));
            } catch (Exception ex) { var response = OrderItemShipGroupAssociationMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }
 public long GetCount(string filter = null)
 {
     try
     {
         long count = 0;
         if (!String.IsNullOrWhiteSpace(filter))
         {
             count = _orderItemShipGroupAssociationMvoApplicationService.GetCount(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver()
                                                                                                          , n => (OrderItemShipGroupAssociationMvoMetadata.Instance.FilteringPropertyAliasDictionary.ContainsKey(n) ? OrderItemShipGroupAssociationMvoMetadata.Instance.FilteringPropertyAliasDictionary[n] : n)));
         }
         else
         {
             count = _orderItemShipGroupAssociationMvoApplicationService.GetCount(OrderItemShipGroupAssociationMvosControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs()));
         }
         return(count);
     } catch (Exception ex) { var response = OrderItemShipGroupAssociationMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
 public IEnumerable <PropertyMetadataDto> GetMetadataFilteringFields()
 {
     try {
         var filtering = new List <PropertyMetadataDto>();
         foreach (var p in OrderItemShipGroupAssociationMvoMetadata.Instance.Properties)
         {
             if (p.IsFilteringProperty)
             {
                 var pdto = new PropertyMetadataDto(p.Name, p.TypeName, p.IsFilteringProperty,
                                                    !String.IsNullOrWhiteSpace(p.SourceChainingName) ? p.SourceChainingName :
                                                    (!String.IsNullOrWhiteSpace(p.DerivedFrom) ? p.DerivedFrom : p.Name));
                 filtering.Add(pdto);
             }
         }
         return(filtering);
     } catch (Exception ex) { var response = OrderItemShipGroupAssociationMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
        public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteOrderItemShipGroupAssociationMvoDto value)
        {
            try {
                // ///////////////////////////////
                if (value.OrderVersion != default(long))
                {
                    value.CommandType = CommandType.MergePatch;
                    OrderItemShipGroupAssociationMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
                    _orderItemShipGroupAssociationMvoApplicationService.When(value as IMergePatchOrderItemShipGroupAssociationMvo);
                    return;
                }
                // ///////////////////////////////

                OrderItemShipGroupAssociationMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
                _orderItemShipGroupAssociationMvoApplicationService.When(value as ICreateOrderItemShipGroupAssociationMvo);
            } catch (Exception ex) { var response = OrderItemShipGroupAssociationMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }
 public IOrderItemShipGroupAssociationMvoStateDto Get(string id, string fields = null)
 {
     try {
         var idObj = OrderItemShipGroupAssociationMvosControllerUtils.ParseIdString(id);
         var state = _orderItemShipGroupAssociationMvoApplicationService.Get(idObj);
         if (state == null)
         {
             return(null);
         }
         var stateDto = new OrderItemShipGroupAssociationMvoStateDtoWrapper(state);
         if (String.IsNullOrWhiteSpace(fields))
         {
             stateDto.AllFieldsReturned = true;
         }
         else
         {
             stateDto.ReturnedFieldsString = fields;
         }
         return(stateDto);
     } catch (Exception ex) { var response = OrderItemShipGroupAssociationMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
 public Type ResolveTypeByPropertyName(string propertyName)
 {
     return(OrderItemShipGroupAssociationMvosControllerUtils.GetFilterPropertyType(propertyName));
 }