public IActionResult GetAdsList(string keyword, int page = 1, int limit = 20, int kid = 0) { int numPerPage, currentPage, startRowIndex; numPerPage = limit; currentPage = page; startRowIndex = (currentPage - 1) * numPerPage; Expression ex = Ads._.Id > 0; if (kid > 0) { ex &= Ads._.KId == kid; } if (!string.IsNullOrWhiteSpace(keyword)) { ex &= Ads._.Title.Contains(keyword); } IList <Ads> list = Ads.FindAll(ex, Ads._.Sequence.Asc().And(Ads._.Id.Desc()), null, startRowIndex, numPerPage); long totalCount = Ads.FindCount(ex, Ads._.Sequence.Asc().And(Ads._.Id.Desc()), null, startRowIndex, numPerPage); return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain")); //return Json(new { total = totalCount, rows = list }, JsonRequestBehavior.AllowGet); }
public JsonResult DelAdsKind(int id) { AdsKind entity = AdsKind.Find(AdsKind._.Id == id); if (entity == null) { tip.Message = "系统找不到本广告分类!"; return(Json(tip)); } //删除旗下广告 IList <Ads> list = Ads.FindAll(Ads._.KId == entity.Id, null, null, 0, 0); if (list != null && list.Count > 0) { list.Delete(); } Core.Admin.WriteLogActions("删除广告分类(id:" + entity.Id + ");"); entity.Delete(); tip.Status = JsonTip.SUCCESS; tip.Message = "删除广告分类成功"; return(Json(tip)); }