Exemple #1
0
        //------------------------------------Product

        public ActionResult WijzigThumb(int pid)
        {
            try
            {
                if (Session["SESwkm"] == null)
                {
                    Session["SESwkm"] = new Winkelmand();
                }
                Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

                mvvm.ListCategorie = categoriedbcontroller.GetAllCategories();
                mvvm.ListMerk      = merkdbcontroler.GetAllMerken();
                mvvm.DetailProduct = productdbcontroller.GetProduct(pid);
                mvvm.ListMand      = qwkm.GetAllwinkelmand();

                List <Merk> merken = merkdbcontroler.GetAllMerken();

                mvvm.SelectedMerkID = mvvm.DetailProduct.merk.ID;

                mvvm.Merken = new SelectList(merken, "ID", "Naam");

                List <Categorie> categorieen = categoriedbcontroller.GetAllCategories();

                mvvm.SelectedCategorieID = mvvm.DetailProduct.cat.ID;

                mvvm.Categorieen = new SelectList(categorieen, "ID", "Naam");

                return(View(mvvm));
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Product Wijzigproduct()");
                return(View(e));
            }
        }
Exemple #2
0
        public ActionResult Detail(int pid = -1)
        {
            try
            {
                //TODO: check if pid bestaat
                if (pid == -1)
                {
                    return(RedirectToAction("Index", "Producten"));
                }
                if (Session["SESwkm"] == null)
                {
                    Session["SESwkm"] = new Winkelmand();
                }
                Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

                mvvm.ListCategorie = categoriedbcontroller.GetAllCategories();
                mvvm.ListProduct   = productdbcontroller.GetAllProducten();
                mvvm.ListMerk      = merkdbcontroler.GetAllMerken();
                mvvm.DetailProduct = productdbcontroller.GetProduct(pid);
                mvvm.ListMand      = qwkm.GetAllwinkelmand();

                return(View(mvvm));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index", "Producten"));
            }
        }
Exemple #3
0
        public void Addwinkelmand(int id)
        {
            if (!CheckBestaandProduct(id))
            {
                ProductDBController prddbctrol = new ProductDBController();
                Product             prd        = prddbctrol.GetProduct(id);

                Mand mand = new Mand {
                    ID = id, Aantal = 1, Naam = prd.Naam, Prijs = prd.Prijs
                };
                winkelMand.Add(mand);
            }
        }