//新增信息表 public ActionResult AddBzcmImage(BzcmText_FanChan btfc) { btfc.Addtime = MvcApplication.GetT_time(); btfc.DEL = 0; btfc.AddUser = LoginUser.ID; btfc.IsFristItemsID = Convert.ToInt32(Request["IsFristItemsID"]); string str = "ok"; if (btfc.ID > 0) { BzcmText_FanChanService.EditEntity(btfc); } else { try { BzcmText_FanChanService.AddEntity(btfc); } catch (Exception e) { if (btfc.Str_Image.Length > 0) { NewDeletFile(btfc.Str_Image); } str = e.ToString(); } } return(Json(new { ret = str }, JsonRequestBehavior.AllowGet)); }
//删除信息或撤销 public ActionResult deldata() { long id = Convert.ToInt64(Request["id"]); var fcdata = BzcmText_FanChanService.LoadEntities(x => x.ID == id).FirstOrDefault(); string ret = "ok"; if (fcdata != null) { fcdata.DEL = fcdata.DEL == 0?1:0; if (!BzcmText_FanChanService.EditEntity(fcdata)) { ret = "未修改成功!"; } } else { ret = "未找到要删除的信息!"; } return(Json(new { ret = ret }, JsonRequestBehavior.AllowGet)); }
//获取信息 public ActionResult GetFanChan() { int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1; int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 5; //构建搜索条件 int totalCount = 0; UserInfoParam userInfoParam = new UserInfoParam() { PageIndex = pageIndex, PageSize = int.MaxValue, TotalCount = totalCount, Items = Request["item"] == null ? "2" : Request["item"], IsMaster = Request["IsHSZ"] == null ? false : Convert.ToBoolean(Request["IsHSZ"]), IsTop = Request["IsTop"] == null ? true : Convert.ToBoolean(Request["IsTop"]) }; var temp = BzcmText_FanChanService.LoadSearchEntities(userInfoParam).OrderBy(x => x.IsTop_shor); return(Json(new { rows = temp, total = userInfoParam.TotalCount }, JsonRequestBehavior.AllowGet)); }