public ActionResult GetDataSource(string User_Name, string User_LoginName, int page = 1, int row = 30) { Expression <Func <view_sys_user_role, bool> > exp = p => 1 == 1; if (!string.IsNullOrEmpty(User_Name)) { exp = exp.And(p => p.User_Name == User_Name); } if (!string.IsNullOrEmpty(User_LoginName)) { exp = exp.And(p => p.User_LoginName == User_LoginName); } var list = _view_sys_user_roleService.GetPageList(exp, page, row, "User_CreateTime desc"); return(Json(list)); }
public IActionResult GetDataSource(string searchKey, string searchValue, int page = 1, int limit = 10) { Expression <Func <view_sys_user_role, bool> > exp = p => 1 == 1; if (searchKey == "loginname" && !string.IsNullOrEmpty(searchValue)) { exp = exp.And(p => p.User_LoginName.Contains(searchValue)); } else if (searchKey == "username" && !string.IsNullOrEmpty(searchValue)) { exp = exp.And(p => p.User_Name.Contains(searchValue)); } var list = _view_sys_user_roleService.GetPageList(exp, page, limit, "User_CreateTime asc"); return(Json(list)); }