コード例 #1
0
        public async Task Post([FromBody] ApiProduct product)
        {
            var dbProduct = _mapper.Map <Product>(product);

            dbProduct.Availability = 50;

            await _catalogService.AddProduct(dbProduct);
        }
コード例 #2
0
        public async Task Post([FromBody] APIProduct value)
        {
            var product = new Product()
            {
                Id   = Guid.NewGuid(),
                Name = "SmartPhone"
            };

            await productCatalogService.AddProduct(product);
        }
コード例 #3
0
 public async Task Post([FromBody] ProductDto product)
 {
     await _productCatalogService.AddProduct(new Product()
     {
         Id           = product.Id,
         Name         = product.Name,
         Description  = product.Description,
         Availability = product.IsAvailable ? 1 : 0,
         Price        = product.Price
     });
 }
コード例 #4
0
        public async Task Post([FromBody] ApiProduct apiProduct)
        {
            var product = new Product
            {
                Id          = Guid.NewGuid(),
                Name        = apiProduct.Name,
                Description = apiProduct.Description,
                Price       = apiProduct.Price
            };

            await catalogService.AddProduct(product);
        }
コード例 #5
0
 public async Task Post([FromBody] ApiProduct product)
 {
     var mappedProduct = new Product()
     {
         Name         = product.Name,
         Id           = product.Id,
         Description  = product.Description,
         Price        = product.Price,
         Availability = 100
     };
     await _catalogService.AddProduct(mappedProduct).ConfigureAwait(false);
 }
コード例 #6
0
        public async Task Post([FromBody] Product product)
        {
            var catalogProduct = new ProductCatalog.Model.Product();

            catalogProduct.Id           = product.Id;
            catalogProduct.Name         = product.Name;
            catalogProduct.Description  = product.Description;
            catalogProduct.Availability = 100;
            catalogProduct.Price        = product.Price;

            await _service.AddProduct(catalogProduct);
        }
コード例 #7
0
 public async Task Post([FromBody] ApiProduct product)
 {
     var newprod = new Product
     {
         Id           = Guid.NewGuid(),
         Name         = product.Name,
         Description  = product.Description,
         Price        = product.Price,
         Availability = 100
     };
     await _catalogService.AddProduct(newprod);
 }
コード例 #8
0
        public async Task AddProduct([FromBody] ApiProduct product)
        {
            var newProduct = new Product()
            {
                Name         = product.Name,
                ProductID    = product.ProductID,
                Avialability = 100,
                Description  = product.Description,
                Price        = product.Price
            };

            await _productCatalogService.AddProduct(newProduct);
        }
コード例 #9
0
        public async Task Post([FromBody] ApiProduct product)
        {
            Product newProduct = new Product()
            {
                Id           = Guid.NewGuid(),
                Name         = product.Name,
                Description  = product.Description,
                Price        = product.Price,
                Availability = 150
            };

            await _productCatalogService.AddProduct(newProduct);
        }
コード例 #10
0
 public async Task Post([FromBody] Product product)
 {
     await _catalogService.AddProduct(product);
 }
コード例 #11
0
 public async Task Post(ProductViewModel product)
 {
     await _catalogService.AddProduct(new ProductCatalog.Model.Product {
         Id = Guid.NewGuid(), Description = product.Description, Name = product.Name, Price = product.Price
     });
 }