예제 #1
0
        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);
        }
예제 #2
0
        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); }
        }
예제 #3
0
 public void When(CreateShipmentPackageDto c)
 {
     WhenAsync(c).GetAwaiter().GetResult();
 }