コード例 #1
0
        public JsonResult GetBrand(int cateId)
        {
            var brandSelect = db.BrandSelects.Where(s => s.seccond_cate_id == cateId).ToList();
            List <BrandSelects> listBrandSelect = new List <BrandSelects>();

            BrandSelects brandSelects = null;

            foreach (var item in brandSelect)
            {
                brandSelects                 = new BrandSelects();
                brandSelects.id              = item.id;
                brandSelects.brand_id        = item.brand_id;
                brandSelects.seccond_cate_id = item.seccond_cate_id;
                listBrandSelect.Add(brandSelects);
            }
            List <Brands> listBrand = new List <Brands>();
            Brands        brands    = null;

            foreach (var item in listBrandSelect)
            {
                brands = new Brands();
                var brand = db.Brands.Where(s => s.brand_id == item.brand_id).FirstOrDefault();
                brands.brand_id = brand.brand_id;
                brands.brand1   = brand.brand1;
                brands.logo     = brand.logo;
                listBrand.Add(brands);
            }
            return(Json(new
            {
                data = listBrand,
                status = true
            }));
        }
コード例 #2
0
        public JsonResult BrandSelect(string brandId, int cateId)
        {
            var brandSelect = db.BrandSelects.Where(s => s.brand_id == brandId && s.seccond_cate_id == cateId).ToList();
            List <BrandSelects> listBrandSelect = new List <BrandSelects>();

            BrandSelects brandSelects = null;

            foreach (var item in brandSelect)
            {
                brandSelects                 = new BrandSelects();
                brandSelects.id              = item.id;
                brandSelects.brand_id        = item.brand_id;
                brandSelects.seccond_cate_id = item.seccond_cate_id;
                listBrandSelect.Add(brandSelects);
            }
            return(Json(new
            {
                data = listBrandSelect,
                status = true
            }));
        }