Exemple #1
0
        public HttpResponseMessage Post([FromBody] CreateSupplierProductDto value)
        {
            try {
                if (value.SupplierProductId == default(SupplierProductId))
                {
                    throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "SupplierProduct");
                }
                _supplierProductApplicationService.When(value as ICreateSupplierProduct);
                var idObj = value.SupplierProductId;

                return(Request.CreateResponse <SupplierProductId>(HttpStatusCode.Created, idObj));
            } catch (Exception ex) { var response = SupplierProductsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }
        public async Task WhenAsync(CreateSupplierProductDto c)
        {
            var idObj         = SupplierProductProxyUtils.ToIdString((c as ICreateSupplierProduct).SupplierProductId);
            var uriParameters = new SupplierProductUriParameters();

            uriParameters.Id = idObj;

            var req = new SupplierProductPutRequest(uriParameters, (CreateSupplierProductDto)c);

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

            SupplierProductProxyUtils.ThrowOnHttpResponseError(resp);
        }
 public void When(CreateSupplierProductDto c)
 {
     WhenAsync(c).GetAwaiter().GetResult();
 }