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); } }
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); }
public void When(CreateInventoryPostingRuleDto c) { WhenAsync(c).GetAwaiter().GetResult(); }