Exemplo n.º 1
0
 public void Put(string id, [FromBody] CreateAttributeSetDto value)
 {
     try {
         AttributeSetsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
         _attributeSetApplicationService.When(value as ICreateAttributeSet);
     } catch (Exception ex) { var response = AttributeSetsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Exemplo n.º 2
0
        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 async Task WhenAsync(CreateAttributeSetDto c)
        {
            var idObj         = (c as ICreateAttributeSet).AttributeSetId;
            var uriParameters = new AttributeSetUriParameters();

            uriParameters.Id = idObj;

            var req = new AttributeSetPutRequest(uriParameters, (CreateAttributeSetDto)c);

            var resp = await _ramlClient.AttributeSet.Put(req);

            AttributeSetProxyUtils.ThrowOnHttpResponseError(resp);
        }
 public void When(CreateAttributeSetDto c)
 {
     WhenAsync(c).GetAwaiter().GetResult();
 }