[HttpGet]//得到所有讨论主题(有效) public async Task <Result> getDiscuss() { List <string> myActions = new List <string>(); Expression <Func <plate, bool> > where = r => r.is_delete == delFlagNormal && myActions.Contains(r.name); foreach (var k in _user.actions) { if (k.action_name == "a-admin") { where = r => r.is_delete == delFlagNormal; break; } else if (k.action_name.Substring(0, 2) == "a-") { myActions.Add(k.action_name.Substring(2)); } } var data = await _plateBll.GetEntities(where).Include(u => u.discusses).ToListAsync(); if (data == null) { return(Result.Success()); } //有权限才往下走 List <discuss> discussList = new List <discuss>(); foreach (var k in data) { foreach (var p in k.discusses) { p.plate = null; discussList.Add(p); } } return(Result.Success().SetData(discussList)); }
public async Task <Result> GetPlates() { var data = await _plateBll.GetEntities(u => u.is_delete == delFlagNormal).AsNoTracking().ToListAsync(); return(Result.Success().SetData(data)); }