// GET: ArticleType public ActionResult Index(QueryArticleInfo query) { var list = ArticleInfoManager.GetInstance().GetPageList(query); ViewBag.Param = query; return(View(list)); }
public ActionResult SubmitEdit(ArticleInfo info) { try { var item = ArticleInfoManager.GetInstance().GetModel(info.ID); if (item == null) { return(Json(new { state = 1, msg = "未找到该条记录" })); } item.typeid = info.typeid; item.parentid = info.parentid; item.title = info.title; item.photourl = info.ImageUrl; item.content = info.Editor; item.updateid = Convert.ToInt32(SessionHelper.GetSession("userid")); item.userid = Convert.ToInt32(SessionHelper.GetSession("userid")); ArticleInfoManager.GetInstance().Update(item); ArticleInfoManager.GetInstance().Save(); return(Json(new { state = 0, msg = "操作成功" })); } catch (Exception e) { return(Json(new { state = 1, msg = e.Message })); } }
public ActionResult Detail(int id) { var model = ArticleInfoManager.GetInstance().GetModel(id); ViewBag.UserName = ""; if (model != null) //阅读次数+1 { model.readcount += 1; ArticleInfoManager.GetInstance().Update(model); ArticleInfoManager.GetInstance().Save(); ViewBag.UserName = UserManager.GetInstance().GetItemById(model.userid).username; } return(View(model)); }
public ActionResult GetArticleList(QueryArticleInfo query) { var list = ArticleInfoManager.GetInstance().GetBlogPageList(query); var data = list.DataList.Select(m => new ArticleInfoItem() { id = m.id, parentid = m.parentid, title = m.title, typeid = m.typeid, photourl = m.photourl, updatetime = m.updatetime, readcount = m.readcount, content = m.content, createtime = m.createtime, UserName = UserManager.GetInstance().GetItemById(m.userid).username, }); return(Json(new { data = data, pagehtml = list.PagerHtml(), index = list.Index })); }
public ActionResult Delete(int id) { try { var item = ArticleInfoManager.GetInstance().SelectOne(m => m.id == id && m.isdelete == false); if (item == null) { return(Json(new { state = 1, msg = "未找到该条纪录," })); } item.isdelete = true; item.updateid = Convert.ToInt32(Session["userid"]); item.updatetime = DateTime.Now; ArticleInfoManager.GetInstance().Update(item); ArticleInfoManager.GetInstance().Save(); return(Json(new { state = 0, msg = "删除成功" })); } catch (System.Exception ex) { LogHelper.log.Error(ex.Message); return(Json(new { state = 1, msg = ex.Message })); } }
public ActionResult SubmitSave(ArticleInfo info) { try { var model = new bjf_articleinfo(); model.typeid = info.typeid; model.parentid = info.parentid; model.title = info.title; model.photourl = info.ImageUrl; model.readcount = 0; model.content = info.Editor; model.createtime = model.updatetime = DateTime.Now; model.createid = model.updateid = Convert.ToInt32(SessionHelper.GetSession("userid")); model.userid = Convert.ToInt32(SessionHelper.GetSession("userid")); ArticleInfoManager.GetInstance().Add(model); ArticleInfoManager.GetInstance().Save(); return(Json(new { state = 0, msg = "操作成功" })); } catch (Exception e) { return(Json(new { state = 1, msg = e.Message })); } }
public ActionResult Edit(int id) { var model = ArticleInfoManager.GetInstance().GetModel(id); return(View(model)); }