public IQueryable <acemail> LoadPageEntities(AcemailParam acemailParam) { var temp = dbsession.acemailDal.GetEntities(a => a.delflag == true); if (!string.IsNullOrEmpty(acemailParam.Account)) { temp = temp.Where(a => a.account.Contains(acemailParam.Account)).AsQueryable(); } if (!string.IsNullOrEmpty(acemailParam.Email)) { temp = temp.Where(a => a.email.Contains(acemailParam.Email)).AsQueryable(); } acemailParam.Total = temp.Count(); return(temp .OrderByDescending(a => a.account) .Skip(acemailParam.PageSize * (acemailParam.PageIndex - 1)) .Take(acemailParam.PageSize).AsQueryable()); //throw new NotImplementedException(); }
public ActionResult GetAcemailLsit() { int pageIndex = Request["Page"] == null ? 1 : int.Parse(Request["page"]); int pageSize = Request["rows"] == null ? 10 : int.Parse(Request["rows"]); int total = 0; string account_ = Request["account"]; string email_ = Request["email"]; var queryAcemail = new AcemailParam() { PageIndex = pageIndex, PageSize = pageSize, Total = total, Account = account_, Email = email_ }; var data = emailService.LoadPageEntities(queryAcemail); // var data = emailService.LoadPageEntities(pageIndex, pageSize, out total, md => true, true, md => md.account); var result = new { total = queryAcemail.Total, rows = data.ToList() }; return Json(result, JsonRequestBehavior.AllowGet); }