重构代码:角色管理页面数据返回值移除check列减少传输量
This commit is contained in:
parent
7adfa472a1
commit
15d7e31c8f
|
@ -20,7 +20,7 @@ namespace Bootstrap.Admin.Controllers.Api
|
||||||
/// <param name="value"></param>
|
/// <param name="value"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public QueryData<Role> Get(QueryRoleOption value)
|
public QueryData<object> Get(QueryRoleOption value)
|
||||||
{
|
{
|
||||||
return value.RetrieveData();
|
return value.RetrieveData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Bootstrap.Admin.Query
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public QueryData<Role> RetrieveData()
|
public QueryData<object> RetrieveData()
|
||||||
{
|
{
|
||||||
// int limit, int offset, string name, string price, string sort, string order
|
// int limit, int offset, string name, string price, string sort, string order
|
||||||
var data = RoleHelper.RetrieveRoles();
|
var data = RoleHelper.RetrieveRoles();
|
||||||
|
@ -33,10 +33,10 @@ namespace Bootstrap.Admin.Query
|
||||||
{
|
{
|
||||||
data = data.Where(t => t.Description.Contains(Description));
|
data = data.Where(t => t.Description.Contains(Description));
|
||||||
}
|
}
|
||||||
var ret = new QueryData<Role>();
|
var ret = new QueryData<object>();
|
||||||
ret.total = data.Count();
|
ret.total = data.Count();
|
||||||
data = Order == "asc" ? data.OrderBy(t => t.RoleName) : data.OrderByDescending(t => t.RoleName);
|
data = Order == "asc" ? data.OrderBy(t => t.RoleName) : data.OrderByDescending(t => t.RoleName);
|
||||||
ret.rows = data.Skip(Offset).Take(Limit);
|
ret.rows = data.Skip(Offset).Take(Limit).Select(r => new { r.Id, r.RoleName, r.Description });
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue