//Get: Manage/Discounts/{Id} public ActionResult Discounts(string id) { ViewBag.Discounts = Korting.All(); ViewBag.Products = Product.All(); if (id != null) { ViewBag.Product = Product.Find(id); ViewBag.Discount = Korting.Find(id); } return(View("~/Views/Manage/Discounts.cshtml")); }
// GET: Manage/Products public ActionResult Products(string id) { ViewBag.Producten = Product.All(); ViewBag.Leverancier = Leverancier.All(); ViewBag.Categorien = Productcategorie.All(); if (id != null) { ViewBag.Product = Product.Find(id); ViewBag.Discount = Korting.Find(id); } return(View("~/Views/Manage/Products.cshtml")); }
public ActionResult DiscountUpdate(FormCollection form) { FormCollection f = form; if (form["updateBtn"] != null) { Korting korting = Korting.Find(form["id"]); korting.EindDatum = Convert.ToDateTime(form["endDate"]); korting.Opmerking = form["Description"]; korting.Kortingspercentage = Convert.ToDouble(form["discountPercentage"]); korting.SaveOrUpdate(); } else if (form["deleteBtn"] != null) { Korting korting = Korting.Find(form["id"]); Korting.RemoveKortingFromProducts(korting.Id.ToString()); korting.Delete(); } return(this.Discounts("")); }