コード例 #1
0
        /// <summary>
        /// 搜索列表筛选条件初始化数据
        /// </summary>
        /// <returns></returns>
        public ActionResult InitData(AppType?type)
        {
            string companyId = "";

            if (type == AppType.Service)
            {
                companyId = ApiUser.Current.ServiceCompanyId ?? "";
            }
            else
            {
                companyId = ApiUser.Current.UseCompanyId ?? "";
            }
            var category = ds.Categorys(companyId, type);
            var area     = ds.Areas(companyId, type);
            var brand    = ds.Brands(companyId, type);

            return(Json(new
            {
                brand = (brand.Count != 0 ? brand.Where(m => m != null).Select(m => new { id = m.BrandId, name = m.Name, right = 0, left = 0, depth = 0 }) : null),
                category = (category.Count != 0 ? category.Where(m => m != null).Select(m => new { id = m.CategoryId, name = m.Name, right = m.Right, left = m.Left, depth = m.LevelDeep }) : null),
                area = (area.Count != 0 ? area.Where(m => m != null).Select(m => new { name = m.Name, right = m.Right, left = m.Left, depth = m.LevelDeep, id = m.AreaId }) : null)
            }, JsonRequestBehavior.AllowGet));
        }