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