public HttpResponseMessage Post([FromBody] CreateOrderShipmentDto value) { try { if (value.OrderShipmentId == default(OrderShipmentId)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "OrderShipment"); } _orderShipmentApplicationService.When(value as ICreateOrderShipment); var idObj = value.OrderShipmentId; return(Request.CreateResponse <OrderShipmentId>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public async Task WhenAsync(CreateOrderShipmentDto c) { var idObj = OrderShipmentProxyUtils.ToIdString((c as ICreateOrderShipment).OrderShipmentId); var uriParameters = new OrderShipmentUriParameters(); uriParameters.Id = idObj; var req = new OrderShipmentPutRequest(uriParameters, (CreateOrderShipmentDto)c); var resp = await _ramlClient.OrderShipment.Put(req); OrderShipmentProxyUtils.ThrowOnHttpResponseError(resp); }
public void When(CreateOrderShipmentDto c) { WhenAsync(c).GetAwaiter().GetResult(); }