public HttpResponseMessage Post([FromBody] CreateOrderItemMvoDto value) { try { if (value.OrderItemId == default(OrderItemId)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "OrderItemMvo"); } _orderItemMvoApplicationService.When(value as ICreateOrderItemMvo); var idObj = value.OrderItemId; return(Request.CreateResponse <OrderItemId>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = OrderItemMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public async Task WhenAsync(CreateOrderItemMvoDto c) { var idObj = OrderItemMvoProxyUtils.ToIdString((c as ICreateOrderItemMvo).OrderItemId); var uriParameters = new OrderItemMvoUriParameters(); uriParameters.Id = idObj; var req = new OrderItemMvoPutRequest(uriParameters, (CreateOrderItemMvoDto)c); var resp = await _ramlClient.OrderItemMvo.Put(req); OrderItemMvoProxyUtils.ThrowOnHttpResponseError(resp); }
public void When(CreateOrderItemMvoDto c) { WhenAsync(c).GetAwaiter().GetResult(); }