/// <summary> /// 新增和编辑验证 /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult CheckAdd(Stattis_Hot model) { string otype = model != null && model.ID == 0 ? "add" : "update"; var result = 0; Expression <Func <Stattis_Hot, bool> > wherelambad = u => 1 == 1;//查询条件; if (otype == "add") { model.CreateTime = model.UpdateTime = DateTime.Now; model.CreateUser = model.UpdateUser = 1; result = Bll.Add(model); } else { model.UpdateTime = DateTime.Now; result = Bll.Update(model); } if (result != 0) { string msg = CommonMsg.SuccessAlert(200, "操作成功 ! ", "Stattis_Hot", callbackType: "closeCurrent"); return(Content(msg)); } else { return(Content(CommonMsg.ErrorAlert(300, "操作失败"))); } }
/// <summary> /// 列表 /// </summary> /// <param name="pageNum"></param> /// <param name="numPerPage"></param> /// <param name="model"></param> /// <returns></returns> public ActionResult Index(int?pageNum, int?numPerPage, Stattis_Hot model) { int pageIndex = pageNum.HasValue ? pageNum.Value : 1; int pageSize = numPerPage.HasValue && numPerPage.Value > 0 ? numPerPage.Value : 20; int recordCount = 0; //(q) => q.id,排序的字段 Expression <Func <Stattis_Hot, bool> > wherelambad = u => 1 == 1;//查询条件; if (model != null && model.lan_hao != 0) { wherelambad = wherelambad = u => u.lan_hao == model.lan_hao;//模糊查找 } //true,升序,false降序 var data = Bll.GetPageEntities <DateTime>(pageIndex, pageSize, out recordCount, wherelambad, (q) => q.CreateTime, false); ViewData["pageIndex"] = pageIndex; ViewData["pageSize"] = pageSize; ViewData["recordCount"] = recordCount; ViewData["CreateTime"] = model.CreateTime != null && model.CreateTime.ToString() != "0001-01-01 00:00:00" ? model.CreateTime.ToString() : ""; ViewData["lan_hao"] = model.lan_hao; var list = data.ToList(); return(View(list)); }
public int Update(Stattis_Hot model) { return(Dal.Update(model)); }
public int Add(Stattis_Hot model) { return(Dal.Add(model)); }