public ActionResult GetModel(int id) { if (id <= 0) { return(WriteError("参数错误")); } var model = FSHistorySer.QueryWhere(c => c.id == id).FirstOrDefault(); return(Json(model)); }
public ActionResult GetModel(int id) { model.FSHistory model = null; if (id > 0) { model = FSHistorySer.QueryWhere(c => c.id == id).FirstOrDefault(); } ViewBag.model = model; return(View()); }
public ActionResult DeleteFSHistory(int id) { var model = FSHistorySer.QueryWhere(c => c.id == id).FirstOrDefault(); FSHistorySer.Delete(model, false); var result = FSHistorySer.SaveChanges(); if (result > 0) { return(WriteSuccess("删除成功")); } return(WriteError("删除失败")); }
/// <summary> /// 给前台页面浏览次数 /// </summary> /// <returns></returns> public ActionResult UpdateLook(int id) { if (id <= 0) { return(WriteError("数据错误")); } var model = FSHistorySer.QueryWhere(c => c.id == id).FirstOrDefault(); FSHistory newModel = new FSHistory(); newModel.id = id; newModel.Look = model.Look + 1; FSHistorySer.Edit(newModel, new string[] { "Look" }); var result = FSHistorySer.SaveChanges(); return(WriteSuccess("浏览成功")); }