public HttpResponseMessage Post([FromBody] CreateShipmentReceiptMvoDto value) { try { if (value.ShipmentReceiptId == default(ShipmentReceiptId)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "ShipmentReceiptMvo"); } _shipmentReceiptMvoApplicationService.When(value as ICreateShipmentReceiptMvo); var idObj = value.ShipmentReceiptId; return(Request.CreateResponse <ShipmentReceiptId>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = ShipmentReceiptMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public async Task WhenAsync(CreateShipmentReceiptMvoDto c) { var idObj = ShipmentReceiptMvoProxyUtils.ToIdString((c as ICreateShipmentReceiptMvo).ShipmentReceiptId); var uriParameters = new ShipmentReceiptMvoUriParameters(); uriParameters.Id = idObj; var req = new ShipmentReceiptMvoPutRequest(uriParameters, (CreateShipmentReceiptMvoDto)c); var resp = await _ramlClient.ShipmentReceiptMvo.Put(req); ShipmentReceiptMvoProxyUtils.ThrowOnHttpResponseError(resp); }
public void When(CreateShipmentReceiptMvoDto c) { WhenAsync(c).GetAwaiter().GetResult(); }