本文整理汇总了C#中IMenuService.ListAllByCondition方法的典型用法代码示例。如果您正苦于以下问题:C# IMenuService.ListAllByCondition方法的具体用法?C# IMenuService.ListAllByCondition怎么用?C# IMenuService.ListAllByCondition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMenuService
的用法示例。
在下文中一共展示了IMenuService.ListAllByCondition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListAllMenuInfo
/// <summary>
/// 获取菜单
/// </summary>
/// <param name="MenuService"></param>
/// <param name="key">移除当前键,当为""或null不移除</param>
/// <returns></returns>
public static List<MenuInfo> ListAllMenuInfo(IMenuService MenuService)
{
NameValueCollection nvc = new NameValueCollection();
nvc.Add("isvalid", "1");
NameValueCollection orderby = new NameValueCollection();
orderby.Add("menuname", "asc");
List<MenuInfo> datalist = MenuService.ListAllByCondition(nvc, orderby);
return datalist;
}
示例2: ListAllMenuInfo
/// <summary>
/// 获取菜单
/// </summary>
/// <param name="MenuService"></param>
/// <param name="key">移除当前键,当为""或null不移除</param>
/// <returns></returns>
public static List<ChooseDictionary> ListAllMenuInfo(IMenuService MenuService, string key)
{
NameValueCollection nvc = new NameValueCollection();
nvc.Add("isvalid", "1");
NameValueCollection orderby = new NameValueCollection();
orderby.Add("menuname", "asc");
List<MenuInfo> datalist = MenuService.ListAllByCondition(nvc, orderby);
if (!string.IsNullOrEmpty(key))
{
datalist.Remove(datalist.Where(x => x.Id.Equals(key)).SingleOrDefault());
}
var dicMenu = (from slist in datalist
select new ChooseDictionary { Text = slist.MenuName, Value = slist.Id, ParentId = slist.ParentId }).ToList();
return dicMenu;
}