public IActionResult Add(Product prod)
        {
            var p = new Product();

            p.Name     = prod.Name;
            p.Price    = prod.Price;
            p.Quantity = prod.Quantity;
            p.Type     = prod.Type;
            var newInventory = _inventory.AddToInventory(p);

            return(RedirectToAction("Index", newInventory));
        }
Example #2
0
        public void Add([FromBody] Product prod)
        {
            var p = new Product();

            p.Name     = prod.Name;
            p.Price    = prod.Price;
            p.Quantity = prod.Quantity;
            p.Type     = prod.Type;
            _inventory.AddToInventory(p);
        }