public ActionResult GetGridJson(Pagination pagination, string keyword) { var newsTypeList = newsTypeApp.GetList(); var listResult = (from a in newsApp.GetList(pagination, keyword) join b in newsTypeList on a.F_Type equals b.F_Id into temp from c in temp.DefaultIfEmpty() select new NewsEntity { F_Id = a.F_Id, F_Author = a.F_Author, F_Content = a.F_Content, F_From = a.F_From, F_CreatorTime = a.F_CreatorTime, F_Status = a.F_Status, F_Title = a.F_Title, F_Type = c.F_Name, }).ToList(); var data = new { rows = listResult, total = pagination.total, page = pagination.page, records = pagination.records }; return(Content(data.ToJson())); }
public ActionResult GetGridJson(Pagination pagination, string keyword) { var data = new { rows = newsApp.GetList(pagination, keyword), total = pagination.total, page = pagination.page, records = pagination.records }; return(Content(data.ToJson())); }
public ActionResult GetAnnouncement(string NewsTypeTwo) { List <NewsTypeEntity> listNewsTypeEntity = newsTypeApp.GetList("", NewsTypeTwo);//通过新闻类型名称获取对应的新闻Id List <NewsEntity> listNewsEntity = newsApp.GetList("", listNewsTypeEntity[0].F_Id); //listNewsEntity.GroupBy(a=>a.F_Id).Select(a=>new NewsEntity //{ // F_Id=a.Key, // F_Content=a.First().F_Content, // F_SortCode=a.Sum(b=>b.F_SortCode) //}) return(Json(listNewsEntity, JsonRequestBehavior.AllowGet)); }