// 列表 // GET: /<controller>/ public async Task <IActionResult> Index(ModuleButtonOption option) { //返回json if (Request.IsAjaxRequest()) { var modules = await ModuleButtonApp.GetSaasModuleListAsync(option); return(Json(new { rows = modules })); } ViewData["ModuleId"] = option.ModuleId; ViewData["ParentId"] = option.ParentId; return(View()); }
/// <summary> /// /// </summary> /// <param name="option"></param> /// <returns></returns> private async Task <List <ModuleButton> > GetListAsync(ModuleButtonOption option) { var predicate = PredicateBuilder.True <ModuleButton>(); if (option != null) { if (option.ModuleId.HasValue && option.ModuleId != 0) { predicate = predicate.And(o => o.ModuleId == option.ModuleId.Value); } if (option.ParentId.HasValue) { predicate = predicate.And(o => o.ParentId == option.ParentId.Value); } } return(await ModuleButtonRep.Find(predicate).ToListAsync()); }
/// <summary> /// Saas模块按钮 /// </summary> /// <param name="option"></param> /// <returns></returns> public async Task <List <ModuleButton> > GetSaasModuleListAsync(ModuleButtonOption option = null) { return(await GetListAsync(option)); }