Exemple #1
0
        public JsonResult <Result <dynamic> > GetAllCategories()
        {
            var categories = CategoryApplication.GetMainCategory();
            var model      = categories.Where(p => p.IsShow).OrderBy(c => c.DisplaySequence).Select(c => new
            {
                cid  = c.Id,
                name = c.Name,
                subs = CategoryApplication.GetCategoryByParentId(c.Id).Select(a => new
                {
                    cid  = a.Id,
                    name = a.Name
                })
            }).ToList();
            var result = SuccessResult <dynamic>(data: model);

            return(Json(result));
        }