Example #1
0
        public async Task <IActionResult> Index()
        {
            IEnumerable <Column2ModelEntity> list = await columnService.GetAllColumn2ModelListAsync();

            var data = list.ToList();
            List <Column2ModelEntity> entitys = data.FindAll(t => t.C_PARENTID == 0);
            int i = 0;

            foreach (var item in entitys)
            {
                if (item.C_CHILDREN > 0)
                {
                    navHtml.AppendFormat("<li{0}>", i > 0 ? " class=\"closed\"" : "");
                    navHtml.AppendFormat("<span class=\"folder\">{0}</span>", item.C_NAME);
                    ResolveSubTree(data, item.C_ID);
                }
                else
                {
                    navHtml.Append("<li>");
                    string link = String.Empty;
                    if (item.C_TYPEID == 10002)
                    {
                        if (item.M_ID > 0)
                        {
                            link = item.M_MANAGEURL + "?cid=" + +item.C_ID;
                        }
                    }
                    navHtml.AppendFormat("<a href=\"{0}\" target=\"myFrameName\"><span class=\"file\">{1}</span></a>", link, item.C_NAME);
                }
                navHtml.Append("</li>");
                i++;
            }
            ViewBag.MenuNav = navHtml.ToString();
            return(View());
        }