Ejemplo n.º 1
0
        public Product(int id, int categorieid, string merk, string serie, int typenummer, decimal prijs)
        {
            this.id = id;
            ProductCatRepository repo = new ProductCatRepository(new ProductCatContext());

            this.categorie  = repo.GetById(categorieid);
            this.merk       = merk;
            this.serie      = serie;
            this.typenummer = typenummer;
            this.prijs      = prijs;
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                pCatRepo              = new  ProductCatRepository();
                Session["pCatRepo"]   = pCatRepo;
                updateFlag            = false;
                Session["updateFlag"] = updateFlag;

                strKey = Request.QueryString["idd"];
                if (strKey != null)
                {
                    fillValues();
                    Session["pcid"] = strKey;
                }
            }
            else
            {
                pCatRepo = (ProductCatRepository)Session["pCatRepo"];
            }
        }
Ejemplo n.º 3
0
        public ActionResult Materiaal()
        {
            if (Session["event"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ProductRepository    prepo = new ProductRepository(new ProductContext());
            ProductCatRepository crepo = new ProductCatRepository(new ProductCatContext());

            List <Product>             allProducts = prepo.GetAll();
            List <ProductCatViewModel> productcats = new List <ProductCatViewModel>();

            foreach (var productCat in crepo.GetAll())
            {
                IEnumerable <Product> products = allProducts.Where(x => x.Categorie.Id == productCat.Id);
                productcats.Add(ModelToViewModel.ConvertProductCatToViewModel(productCat, products));
            }

            ProductVerhuurViewModel model = new ProductVerhuurViewModel()
            {
                AllProducts      = ModelToViewModel.ConvertProductToViewModelList(allProducts),
                ProductCats      = productcats,
                SelectedProducts = new List <ProductViewModel>()
            };

            ReserveringViewModel reservering = (ReserveringViewModel)Session["reservering"];

            if (reservering.Producten == null)
            {
                reservering.Producten = new List <Product>();
            }
            ViewData["producten"]   = reservering.Producten;
            ViewData["totaalprijs"] = reservering.Producten.Sum(x => x.Prijs);

            return(View(model));
        }