예제 #1
0
        public HttpResponseMessage Post([FromBody] CreateInventoryPostingRuleDto value)
        {
            try {
                if (value.InventoryPostingRuleId == default(string))
                {
                    throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "InventoryPostingRule");
                }
                _inventoryPostingRuleApplicationService.When(value as ICreateInventoryPostingRule);
                var idObj = value.InventoryPostingRuleId;

                return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj));
            } catch (Exception ex) { var response = InventoryPostingRulesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }
예제 #2
0
        public async Task WhenAsync(CreateInventoryPostingRuleDto c)
        {
            var idObj         = (c as ICreateInventoryPostingRule).InventoryPostingRuleId;
            var uriParameters = new InventoryPostingRuleUriParameters();

            uriParameters.Id = idObj;

            var req = new InventoryPostingRulePutRequest(uriParameters, (CreateInventoryPostingRuleDto)c);

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

            InventoryPostingRuleProxyUtils.ThrowOnHttpResponseError(resp);
        }
예제 #3
0
 public void When(CreateInventoryPostingRuleDto c)
 {
     WhenAsync(c).GetAwaiter().GetResult();
 }