Exemplo n.º 1
0
        public HttpResponseMessage Post([FromBody] CreateShipmentMethodTypeDto value)
        {
            try {
                if (value.ShipmentMethodTypeId == default(string))
                {
                    throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "ShipmentMethodType");
                }
                _shipmentMethodTypeApplicationService.When(value as ICreateShipmentMethodType);
                var idObj = value.ShipmentMethodTypeId;

                return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj));
            } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }
Exemplo n.º 2
0
        public async Task WhenAsync(CreateShipmentMethodTypeDto c)
        {
            var idObj         = (c as ICreateShipmentMethodType).ShipmentMethodTypeId;
            var uriParameters = new ShipmentMethodTypeUriParameters();

            uriParameters.Id = idObj;

            var req = new ShipmentMethodTypePutRequest(uriParameters, (CreateShipmentMethodTypeDto)c);

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

            ShipmentMethodTypeProxyUtils.ThrowOnHttpResponseError(resp);
        }
Exemplo n.º 3
0
 public void When(CreateShipmentMethodTypeDto c)
 {
     WhenAsync(c).GetAwaiter().GetResult();
 }