// GET: Home
        public ActionResult Index()
        {
            ViewBag.TitlePage = "Online Shopping | Home";
            ViewBag.Page      = "Home";

            HomeProductsModel homeProduct = new HomeProductsModel();
            ProductDAL        productDal  = new ProductDAL();

            List <Product> products = productDal.getTopNewProduct();

            homeProduct.NewProducts = products;

            products = productDal.getTopTrending();
            homeProduct.TrendingProducts = products;

            products = productDal.getTopBestSeller();
            homeProduct.BestSellerProducts = products;

            CatalogueDAL     catalogueDal = new CatalogueDAL();
            List <Catalogue> catalogues   = catalogueDal.getAllCatalogues();

            homeProduct.Catalogues = catalogues;

            return(View(homeProduct));
        }
        // GET: Product
        public ActionResult ProductDetails(string productIDStr)
        {
            int id = 1;

            if (int.TryParse(productIDStr, out id))
            {
                id = int.Parse(productIDStr);
            }

            ProductDAL   productDal   = new ProductDAL();
            Product      product      = productDal.getProductById(id);
            CatalogueDAL catalogueDal = new CatalogueDAL();
            Catalogue    catalogue    = catalogueDal.getCatalogueById(product.Catalogue_ID);

            catalogueDal.getAllProductsByCatalogue(catalogue);
            List <Catalogue> catalogues = catalogueDal.getAllCatalogues();

            ProductDetailsModel productDetails = new ProductDetailsModel
            {
                ProductCatalogue = catalogue,
                ProductDetails   = product,
                Catalogues       = catalogues,
            };

            return(View(productDetails));
        }
        public void UploadEntries(List <CatalogueEntry> entries)
        {
            CatalogueDAL catDal = new CatalogueDAL();

            catDal.CatalogueEntries.AddRange(entries);
            catDal.SaveChanges();
        }
        public CatalogueEntry SaveEntry(CatalogueEntry c)
        {
            CatalogueDAL catDal = new CatalogueDAL();

            catDal.CatalogueEntries.Add(c);
            catDal.SaveChanges();
            return(c);
        }
        public ActionResult Catalogue(string IDStr)
        {
            int ID = 1;

            if (int.TryParse(IDStr, out ID))
            {
                ID = int.Parse(IDStr);
            }
            CatalogueDAL catalogueDal = new CatalogueDAL();
            Catalogue    catalogue    = catalogueDal.getCatalogueById(ID);

            catalogueDal.getAllProductsByCatalogue(catalogue);
            return(View(catalogue));
        }
        public List <CatalogueEntry> GetEntries()
        {
            CatalogueDAL catDal = new CatalogueDAL();

            return(catDal.CatalogueEntries.ToList());
        }