public ActionResult List(LoveFundType type, int page = 1, int pageSize = 8) { LoveFundModel model = new LoveFundModel(); model.Type = type; model.LoveFundPageList = GetListLoveFund(type, page, pageSize); return View(model); }
//获取最近的列表 private IPagedList<LoveFundModel> GetListLoveFund(LoveFundType type,int page = 1, int pageSize = 8) { using (LoveBankDBContext db = new LoveBankDBContext()) { var tws = db.T_LoveFund; var list2 = from w in tws select new LoveFundModel { AddTime = w.AddTime, Title = w.Title, DeptId = w.DeptId, Sort = w.Sort, Type=w.Type }; if (type!=LoveFundType.未知) { list2 = list2.Where(x=>x.Type == type); } return list2.Where(x => x.DeptId == BaseWebSiteConifg.DeptId).OrderByDescending(x => x.Sort).ToPagedList(page-1, pageSize); } }
/// <summary> /// 获取爱心基金 /// </summary> /// <param name="teamProjectId"></param> /// <returns></returns> public ActionResult App_GetLoveFoundIndex(string deptId, LoveFundType type, int page = 1, int pageSize = 20) { JsonMessage retJson = new JsonMessage(); using (LoveBankDBContext db = new LoveBankDBContext()) { var tws = db.T_LoveFund; var list2 = from w in tws select new LoveFundModel { AddTime = w.AddTime, Title = w.Title, DeptId = w.DeptId, Sort = w.Sort, Type = w.Type, ID=w.ID }; if ((int)type>0) { list2= list2.Where(x=>x.Type == type); } retJson.Status = true; retJson.Data = list2.Where(x => x.DeptId == deptId).OrderByDescending(x => x.Sort).ToPagedList(page-1, pageSize).ToList(); return Json(retJson); } }
//获取最新的爱心基金 private LoveFundModel GetNewLoveFund(LoveFundType type) { using (LoveBankDBContext db = new LoveBankDBContext()) { var tws = db.T_LoveFund; var list2 = from w in tws select new LoveFundModel { AddTime = w.AddTime, Title = w.Title, DeptId = w.DeptId, Sort = w.Sort, Type = w.Type }; return list2.Where(x => x.DeptId == BaseWebSiteConifg.DeptId && x.Type == type).OrderByDescending(x => x.Sort).FirstOrDefault(); } }
public ActionResult IndexData(LoveFundType type, int page = 1, int pageSize = 8) { JsonMessage rMsg = new JsonMessage(); return Json(rMsg); }