public void Patch(string id, [FromBody] MergePatchInOutLineMvoDto value) { try { InOutLineMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _inOutLineMvoApplicationService.When(value as IMergePatchInOutLineMvo); } catch (Exception ex) { var response = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <IInOutLineMvoStateDto> GetAll(string sort = null, string fields = null, int firstResult = 0, int maxResults = int.MaxValue, string filter = null) { try { IEnumerable <IInOutLineMvoState> states = null; if (!String.IsNullOrWhiteSpace(filter)) { states = _inOutLineMvoApplicationService.Get(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver() , n => (InOutLineMvoMetadata.Instance.FilteringPropertyAliasDictionary.ContainsKey(n) ? InOutLineMvoMetadata.Instance.FilteringPropertyAliasDictionary[n] : n)) , InOutLineMvosControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); } else { states = _inOutLineMvoApplicationService.Get(InOutLineMvosControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs()) , InOutLineMvosControllerUtils.GetQueryOrders(sort, QueryOrderSeparator), firstResult, maxResults); } var stateDtos = new List <IInOutLineMvoStateDto>(); foreach (var s in states) { var dto = s is InOutLineMvoStateDtoWrapper ? (InOutLineMvoStateDtoWrapper)s : new InOutLineMvoStateDtoWrapper(s); if (String.IsNullOrWhiteSpace(fields)) { dto.AllFieldsReturned = true; } else { dto.ReturnedFieldsString = fields; } stateDtos.Add(dto); } return(stateDtos); } catch (Exception ex) { var response = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IInOutLineMvoStateEvent GetStateEvent(string id, long version) { try { var idObj = InOutLineMvosControllerUtils.ParseIdString(id); return(_inOutLineMvoApplicationService.GetStateEvent(idObj, version)); } catch (Exception ex) { var response = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public InOutLineMvoStateCreatedOrMergePatchedOrDeletedDto GetStateEvent(string id, long version) { try { var idObj = InOutLineMvosControllerUtils.ParseIdString(id); var conv = new InOutLineMvoStateEventDtoConverter(); var se = _inOutLineMvoApplicationService.GetEvent(idObj, version); return(se == null ? null : conv.ToInOutLineMvoStateEventDto(se)); } catch (Exception ex) { var response = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Delete(string id, string commandId, string version, string requesterId = default(string)) { try { var value = new DeleteInOutLineMvoDto(); value.CommandId = commandId; value.RequesterId = requesterId; value.InOutVersion = (long)Convert.ChangeType(version, typeof(long)); InOutLineMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _inOutLineMvoApplicationService.When(value as IDeleteInOutLineMvo); } catch (Exception ex) { var response = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public HttpResponseMessage Post([FromBody] CreateInOutLineMvoDto value) { try { if (value.InOutLineId == default(InOutLineId)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "InOutLineMvo"); } _inOutLineMvoApplicationService.When(value as ICreateInOutLineMvo); var idObj = value.InOutLineId; return(Request.CreateResponse <InOutLineId>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <PropertyMetadata> GetMetadataFilteringFields() { try { var filtering = new List <PropertyMetadata>(); foreach (var p in InOutLineMvoMetadata.Instance.Properties) { if (p.IsFilteringProperty) { filtering.Add(p); } } return(filtering); } catch (Exception ex) { var response = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public long GetCount(string filter = null) { try { long count = 0; if (!String.IsNullOrWhiteSpace(filter)) { count = _inOutLineMvoApplicationService.GetCount(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver())); } else { count = _inOutLineMvoApplicationService.GetCount(InOutLineMvosControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs())); } return(count); } catch (Exception ex) { var response = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <PropertyMetadataDto> GetMetadataFilteringFields() { try { var filtering = new List <PropertyMetadataDto>(); foreach (var p in InOutLineMvoMetadata.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 = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteInOutLineMvoDto value) { try { // /////////////////////////////// if (value.InOutVersion != default(long)) { value.CommandType = CommandType.MergePatch; InOutLineMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _inOutLineMvoApplicationService.When(value as IMergePatchInOutLineMvo); return; } // /////////////////////////////// InOutLineMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _inOutLineMvoApplicationService.When(value as ICreateInOutLineMvo); } catch (Exception ex) { var response = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IInOutLineMvoStateDto Get(string id, string fields = null) { try { var idObj = InOutLineMvosControllerUtils.ParseIdString(id); var state = _inOutLineMvoApplicationService.Get(idObj); if (state == null) { return(null); } var stateDto = new InOutLineMvoStateDtoWrapper(state); if (String.IsNullOrWhiteSpace(fields)) { stateDto.AllFieldsReturned = true; } else { stateDto.ReturnedFieldsString = fields; } return(stateDto); } catch (Exception ex) { var response = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public Type ResolveTypeByPropertyName(string propertyName) { return(InOutLineMvosControllerUtils.GetFilterPropertyType(propertyName)); }