public async Task WhenAsync(CreateShipmentDto c)
        {
            var idObj         = (c as ICreateShipment).ShipmentId;
            var uriParameters = new ShipmentUriParameters();

            uriParameters.Id = idObj;

            var req = new ShipmentPutRequest(uriParameters, (CreateShipmentDto)c);

            var resp = await _ramlClient.Shipment.Put(req);

            ShipmentProxyUtils.ThrowOnHttpResponseError(resp);
        }
Example #2
0
        public HttpResponseMessage Post([FromBody] CreateShipmentDto value)
        {
            try {
                if (value.ShipmentId == default(string))
                {
                    throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "Shipment");
                }
                _shipmentApplicationService.When(value as ICreateShipment);
                var idObj = value.ShipmentId;

                return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj));
            } catch (Exception ex) { var response = ShipmentsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }
 public void When(CreateShipmentDto c)
 {
     WhenAsync(c).GetAwaiter().GetResult();
 }