本文整理汇总了C#中Module.Where方法的典型用法代码示例。如果您正苦于以下问题:C# Module.Where方法的具体用法?C# Module.Where怎么用?C# Module.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module.Where方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetModelList
/// <summary>
/// 获取所有模块信息
/// </summary>
/// <returns></returns>
public static List<Module> GetModelList()
{
try
{
var moduleList = new Module().FindAll().OrderBy(c => c.Level).ToList();
List<Module> menuList = null;
if (moduleList != null && moduleList.Count > 0)
{
menuList = new List<Module>();
Module firstMenu = null;
foreach (var first in moduleList.Where(c => c.ParentID == 0).ToList())
{
firstMenu = new Module();
firstMenu = first;
var secondMenuListTemp = moduleList.Where(c => c.ParentID == first.ID).ToList();
if (secondMenuListTemp != null && secondMenuListTemp.Count > 0)
{
var secondMenuList = new List<Module>();
foreach (var second in secondMenuListTemp)
{
var secondeMenu = new Module();
secondeMenu = second;
var thirdMenuList = moduleList.Where(c => c.ParentID == second.ID).ToList();
secondeMenu.ChildrenList = thirdMenuList;
secondMenuList.Add(secondeMenu);
}
firstMenu.ChildrenList = secondMenuList;
}
menuList.Add(firstMenu);
}
}
return menuList;
}
catch (Exception ex)
{
LogHelper.Write(CommonLogger.Web, ex);
}
return null;
}