public ActionResult Delete(int productOptionId, int productId, ProductOption productOption) { try { var db = new CRUDExample(); var model = (from po in db.ProductOption where po.Id == productOptionId select po).FirstOrDefault(); if (model != null) { db.ProductOption.Remove(model); db.SaveChanges(); } return RedirectToAction("Details", "Product", new { productId = productId }); } catch { // Set the Product Node's Title SetNodeTitle(GetProductName(productId), 3); return View(); } }
public ActionResult Create(int productId, ProductOption productOption) { try { var db = new CRUDExample(); var model = new ProductOption(); if (model != null) { model.ProductId = productId; model.Name = productOption.Name; db.ProductOption.Add(model); db.SaveChanges(); } return RedirectToAction("Details", "Product", new { productId = productId }); } catch { // Set the Product Node's Title SetNodeTitle(GetProductName(productId), 2); return View(); } }