public async Task <IActionResult> Add(Product p) { try { // TODO: Add insert logic here await ProductsDb.Add(p, _context); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Save(Product product) { var newProduct = ProductsDb.Add(product); return(RedirectToAction("Index")); }
public IActionResult Post([FromBody] Product prd) { products.Add(prd); return(Ok(products)); }