STAGE 2 OK
This commit is contained in:
@@ -54,7 +54,7 @@ public class activity_kindController : ApiController
|
|||||||
public IHttpActionResult GetList([FromBody] Model.ViewModel.actItem_kind q,
|
public IHttpActionResult GetList([FromBody] Model.ViewModel.actItem_kind q,
|
||||||
int page, int pageSize = 10, string sortBy = "", bool sortDesc = false)
|
int page, int pageSize = 10, string sortBy = "", bool sortDesc = false)
|
||||||
{
|
{
|
||||||
var qry = _db.actItem_kind.AsEnumerable();
|
var qry = _db.actItem_kind.AsQueryable();
|
||||||
if (!string.IsNullOrEmpty(q.kind))
|
if (!string.IsNullOrEmpty(q.kind))
|
||||||
qry = qry.Where(o => o.kind.Contains(q.kind));
|
qry = qry.Where(o => o.kind.Contains(q.kind));
|
||||||
if (!string.IsNullOrEmpty(q.status))
|
if (!string.IsNullOrEmpty(q.status))
|
||||||
|
|||||||
@@ -44,19 +44,22 @@ public class appellationController : BaseApiController
|
|||||||
public IHttpActionResult GetList([FromBody] Model.appellation q,
|
public IHttpActionResult GetList([FromBody] Model.appellation q,
|
||||||
int page, int pageSize = 10, string sortBy = "", bool sortDesc = false)
|
int page, int pageSize = 10, string sortBy = "", bool sortDesc = false)
|
||||||
{
|
{
|
||||||
var qry = _db.appellations.AsEnumerable();
|
var qry = _db.appellations.AsQueryable();
|
||||||
|
|
||||||
|
|
||||||
qry = qry.OrderBy(o => o.num);
|
qry = qry.OrderBy(o => o.num);
|
||||||
|
|
||||||
|
var count = qry.Count();
|
||||||
|
var qryList = (pageSize > 0) ? qry.ToPagedList(page, pageSize).ToList() : qry.ToList();
|
||||||
|
|
||||||
var ret = new
|
var ret = new
|
||||||
{
|
{
|
||||||
list = qry.ToPagedList(page, pageSize).Select(x => new
|
list = qryList.Select(x => new
|
||||||
{
|
{
|
||||||
num = x.num,
|
num = x.num,
|
||||||
title = x.title,
|
title = x.title,
|
||||||
}),
|
}),
|
||||||
count = qry.Count()
|
count = count
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,22 +44,25 @@ public class countryController : BaseApiController
|
|||||||
public IHttpActionResult GetList([FromBody] Model.ViewModel.country q,
|
public IHttpActionResult GetList([FromBody] Model.ViewModel.country q,
|
||||||
int page, int pageSize = 10, string sortBy = "", bool sortDesc = false)
|
int page, int pageSize = 10, string sortBy = "", bool sortDesc = false)
|
||||||
{
|
{
|
||||||
var qry = _db.countries.AsEnumerable();
|
var qry = _db.countries.AsQueryable();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(q.keyword))
|
if (!string.IsNullOrEmpty(q.keyword))
|
||||||
qry = qry.Where(o => o.ID.Contains(q.keyword.Trim()) || o.name_en.Contains(q.keyword.Trim()) || o.name_zh.Contains(q.keyword.Trim()));
|
qry = qry.Where(o => o.ID.Contains(q.keyword.Trim()) || o.name_en.Contains(q.keyword.Trim()) || o.name_zh.Contains(q.keyword.Trim()));
|
||||||
|
|
||||||
qry = qry.OrderBy(o => o.range).ThenBy(o => o.name_en);
|
qry = qry.OrderBy(o => o.range).ThenBy(o => o.name_en);
|
||||||
|
|
||||||
|
var count = qry.Count();
|
||||||
|
var qryList = (pageSize > 0) ? qry.ToPagedList(page, pageSize).ToList() : qry.ToList();
|
||||||
|
|
||||||
var ret = new
|
var ret = new
|
||||||
{
|
{
|
||||||
list = qry.ToPagedList(page, pageSize).Select(x => new
|
list = qryList.Select(x => new
|
||||||
{
|
{
|
||||||
id = x.ID,
|
id = x.ID,
|
||||||
name_en = x.name_en,
|
name_en = x.name_en,
|
||||||
name_zh = x.name_zh,
|
name_zh = x.name_zh,
|
||||||
}),
|
}),
|
||||||
count = qry.Count()
|
count = count
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class member_titleController : ApiController
|
|||||||
public IHttpActionResult GetList([FromBody] Model.ViewModel.member_title q,
|
public IHttpActionResult GetList([FromBody] Model.ViewModel.member_title q,
|
||||||
int page, int pageSize = 10, string sortBy = "", bool sortDesc = false)
|
int page, int pageSize = 10, string sortBy = "", bool sortDesc = false)
|
||||||
{
|
{
|
||||||
var qry = _db.member_title.AsEnumerable();
|
var qry = _db.member_title.AsQueryable();
|
||||||
var ret = new { list = "", count = 0 };
|
var ret = new { list = "", count = 0 };
|
||||||
return Ok(ret);
|
return Ok(ret);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user