Ejemplo n.º 1
0
        public ActionResult List(int?id)
        {
            ListProductViewModel2 model = new ListProductViewModel2();

            var cate = db.Categories.Find(id);

            if (cate.Parent > 0)
            {
                var p = db.Categories.Find(cate.Parent);
                model.TitleParent = p.CategoryName;
                model.LinkParent  = "/san-pham/" + p.SEOUrlRewrite + "-" + p.CategoryID;
            }
            else
            {
                model.TitleParent = "Nội thất giá rẻ Bình Dương, nội thất chung cư bình dương";
                model.LinkParent  = "/san-pham";
            }


            model.Title      = cate.CategoryName;
            model.categories = db.Categories.Where(q => q.IsActive == true && q.TypeCate == 1 && q.Parent == 0).ToList();
            var slide = db.Slides.Where(q => q.IsActive == true && q.CategoryID == id).ToList();

            if (slide.Count == 0)
            {
                model.slides = db.Slides.Where(q => q.IsActive == true && q.CategoryID == -1).ToList();
            }
            else
            {
                model.slides = slide;
            }

            if (cate.Parent == 0)
            {
                model.products = db.Products.Where(q => q.IsActive == true && q.IsProduct == true && q.CategoryIDParent == id).ToList();
            }
            else
            {
                model.products = db.Products.Where(q => q.IsActive == true && q.IsProduct == true && q.CategoryID == id).ToList();
            }

            model.LeftPromote = db.Advertises.Where(a => a.IsActive == true && a.Location == WebConstants.PromoteLeft).ToList();
            model.listviewed  = GetListProduct();

            model.category = cate;

            model.SEOTitle           = cate.SEOTitle;
            model.SEOKeywords        = cate.SEOKeywords;
            model.SEOMetadescription = cate.SEOMetadescription;

            return(View(model));
        }
Ejemplo n.º 2
0
        // GET: Product
        public ActionResult Index()
        {
            ListProductViewModel2 model = new ListProductViewModel2();

            model.Title       = "Nội thất giá rẻ Bình Dương, nội thất chung cư bình dương";
            model.categories  = db.Categories.Where(q => q.IsActive == true && q.TypeCate == 1 && q.Parent == 0).ToList();
            model.slides      = db.Slides.Where(q => q.IsActive == true && q.CategoryID == -1).ToList();
            model.products    = db.Products.Where(q => q.IsActive == true && q.IsProduct == true).ToList();
            model.LeftPromote = db.Advertises.Where(a => a.IsActive == true && a.Location == WebConstants.PromoteLeft).ToList();
            model.listviewed  = GetListProduct();

            model.SEOTitle           = model.Title;
            model.SEOKeywords        = "Nội thất giá rẻ Bình Dương, Nội thất Chung Cư Bình Dương, nội thất Bình Dương, Thiết kế nội thất binh duong";
            model.SEOMetadescription = "chuyên cung cấp các sản phẩm nội thất giá rẻ tại Bình Dương, Nội thất chung cư tại Bình Dương, với đội ngũ thiết kế nội thất nhiều năm kinh nghiêm luôn tạo ra những sản phẩm nội thất giá rẻ tại Bình Dương cũng như toàn bộ khu vực.";

            return(View(model));
        }