示例#1
0
        public HttpResponseMessage Post([FromBody] CreateShipmentTypeDto value)
        {
            try {
                if (value.ShipmentTypeId == default(string))
                {
                    throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "ShipmentType");
                }
                _shipmentTypeApplicationService.When(value as ICreateShipmentType);
                var idObj = value.ShipmentTypeId;

                return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj));
            } catch (Exception ex) { var response = ShipmentTypesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }
        public async Task WhenAsync(CreateShipmentTypeDto c)
        {
            var idObj         = (c as ICreateShipmentType).ShipmentTypeId;
            var uriParameters = new ShipmentTypeUriParameters();

            uriParameters.Id = idObj;

            var req = new ShipmentTypePutRequest(uriParameters, (CreateShipmentTypeDto)c);

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

            ShipmentTypeProxyUtils.ThrowOnHttpResponseError(resp);
        }
 public void When(CreateShipmentTypeDto c)
 {
     WhenAsync(c).GetAwaiter().GetResult();
 }