public ActionResult UpdateBlogs(FormCollection fc) { #region 验证用户信息 string _SessionId = HttpContext.Request.Cookies["SessionId"].Value; string _UserProfileJson = RedisHelper.ItemGet <string>(_SessionId); #endregion var _Content = fc["editor"]; var _BlogsId = fc["BlogsId"]; if (!string.IsNullOrEmpty(_UserProfileJson)) { UserProfile _UserProfile = ToolMethod.GetUerProfile(_UserProfileJson); BlogsInfo _BlogsInfo = _IBlogsInfoBLL.GetModels(x => x.Id == _BlogsId && x.Delflag == EnumType.DelflagType.正常, true, null, "BlogsInfo").FirstOrDefault(); _BlogsInfo.BlogContent = _Content; _BlogsInfo.UDate = ToolMethod.GetNow(); RedisHelper.HashSet <BlogsInfo>("BlogsInfo", _BlogsId, _BlogsInfo); BackgroundJobClient _Job = new BackgroundJobClient(); _Job.Enqueue(() => _IBlogsInfoBLL.Update(_BlogsInfo)); return(Json(new { Success = true, SuccessModel = "修改博客成功!" })); } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult UpdateBlogs(string Id) { BlogsInfo _BlogsInfo = _IBlogsInfoBLL.GetModels(x => x.Id == Id && x.Delflag == EnumType.DelflagType.正常, true, null, "BlogsInfo").FirstOrDefault(); ViewBag.BlogsId = Id; return(View(_BlogsInfo)); }
public ActionResult DeleteBlogs(string Id) { BlogsInfo _BlogsInfo = _IBlogsInfoBLL.GetModels(x => x.Id == Id && x.Delflag == EnumType.DelflagType.正常, true, null, "BlogsInfo").FirstOrDefault(); _BlogsInfo.Delflag = EnumType.DelflagType.已删除; RedisHelper.HashSet("BlogsInfo", Id, _BlogsInfo); BackgroundJobClient _Job = new BackgroundJobClient(); _Job.Enqueue(() => _IBlogsInfoBLL.Update(_BlogsInfo)); return(Json(new { Success = true, SuccessModel = "删除博客成功!" })); }
public ActionResult AddBlogs(FormCollection fc) { #region 验证用户信息 string _SessionId = HttpContext.Request.Cookies["SessionId"].Value; string _UserProfileJson = RedisHelper.ItemGet <string>(_SessionId); #endregion if (!string.IsNullOrEmpty(_UserProfileJson)) { UserProfile _UserProfile = ToolMethod.GetUerProfile(_UserProfileJson); //获取标题 var _BlogsHeading = fc["BlogsHeading"]; //获取副标题 string _BlogsSubHeading = fc["BlogsSubHeading"]; //获取简介 var _BlogsAbstract = fc["BlogsAbstract"]; //获取Ueditor内容 var _Content = fc["editor"]; //获取封面图ID string _SurfacePlot = fc["SurfacePlot"]; BlogsInfo _BlogsInfo = new BlogsInfo() { Id = ToolMethod.GetGuid(), BlogAuthorId = _UserProfile.Id, BlogAuthorName = _UserProfile.NickName, BlogContent = _Content, BlogHeading = _BlogsHeading, BlogsSurfacePlot = _SurfacePlot, BlogSubHeading = _BlogsSubHeading, CDate = ToolMethod.GetNow(), CommentNum = 0, Delflag = EnumType.DelflagType.正常, UDate = ToolMethod.GetNow(), LikeNum = 0, BlogAbstarct = _BlogsAbstract, }; RedisHelper.HashSet <BlogsInfo>("BlogsInfo", _BlogsInfo.Id, _BlogsInfo); BackgroundJobClient _Job = new BackgroundJobClient(); _Job.Enqueue(() => _IBlogsInfoBLL.Add(_BlogsInfo)); } return(Json(new { Success = true, SuccessModel = "添加博客成功!" })); }