public void Patch(string id, [FromBody] MergePatchAttributeSetDto value) { try { AttributeSetsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeSetApplicationService.When(value as IMergePatchAttributeSet); } catch (Exception ex) { var response = AttributeSetsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IAttributeSetStateEvent GetStateEvent(string id, long version) { try { var idObj = id; return(_attributeSetApplicationService.GetStateEvent(idObj, version)); } catch (Exception ex) { var response = AttributeSetsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Delete(string id, string commandId, string version, string requesterId = default(string)) { try { var value = new DeleteAttributeSetDto(); value.CommandId = commandId; value.RequesterId = requesterId; value.Version = (long)Convert.ChangeType(version, typeof(long)); AttributeSetsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeSetApplicationService.When(value as IDeleteAttributeSet); } catch (Exception ex) { var response = AttributeSetsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public HttpResponseMessage Post([FromBody] CreateAttributeSetDto value) { try { if (value.AttributeSetId == default(string)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "AttributeSet"); } _attributeSetApplicationService.When(value as ICreateAttributeSet); var idObj = value.AttributeSetId; return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = AttributeSetsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public IEnumerable <PropertyMetadata> GetMetadataFilteringFields() { try { var filtering = new List <PropertyMetadata>(); foreach (var p in AttributeSetMetadata.Instance.Properties) { if (p.IsFilteringProperty) { filtering.Add(p); } } return(filtering); } catch (Exception ex) { var response = AttributeSetsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public long GetCount(string filter = null) { try { long count = 0; if (!String.IsNullOrWhiteSpace(filter)) { count = _attributeSetApplicationService.GetCount(CriterionDto.ToSubclass(JObject.Parse(filter).ToObject <CriterionDto>(), new ApiControllerTypeConverter(), new PropertyTypeResolver())); } else { count = _attributeSetApplicationService.GetCount(AttributeSetsControllerUtils.GetQueryFilterDictionary(this.Request.GetQueryNameValuePairs())); } return(count); } catch (Exception ex) { var response = AttributeSetsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteAttributeSetDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; AttributeSetsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeSetApplicationService.When(value as IMergePatchAttributeSet); return; } // /////////////////////////////// AttributeSetsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeSetApplicationService.When(value as ICreateAttributeSet); } catch (Exception ex) { var response = AttributeSetsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }