public ActionResult Create() { if (Request.Url.Host.ToLower() != "manage.blogmi.cn") { return(Content("本域名下不允许创建博客,请在<a href='http://manage.blogmi.cn/BlogManager/Create'>这里创建", "text/html")); } blog_tb_blog entity = new blog_tb_blog(); entity.userID = UserInfo.UserID; entity.ADD_DATE = DateTime.Now; entity.UPDATE_DATE = DateTime.Now; Blog m = ObjectHelper.CloneProperties <Blog>(entity); var themeSelect = new List <object> { new { themeID = "Default" }, new { themeID = "Cnblogs" }, new { themeID = "Muchun" }, new { themeID = "V2" }, new { themeID = "V3" }, new { themeID = "V4" }, }; ViewData["themeIDSelect"] = new SelectList(themeSelect, "themeID", "themeID"); return(View("~/Views/" + Utility.Version + "/BlogManager/Create.cshtml", m)); }
public ActionResult EditModel(string id) { blog_tb_blog entity = Utility.BlogBll.GetSingleBlogByUserID(UserInfo.UserID); if (entity == null) { throw new CustomException("你还没有创建博客"); } if (Convert.ToInt32(id) != entity.blogID) { return(Json(new { code = -1, message = "你无权操作该博客" }, JsonRequestBehavior.AllowGet)); } Blog m = ObjectHelper.CloneProperties <Blog>(entity); ViewBag.Pic = m.blogLogo; if (String.IsNullOrEmpty(m.blogLogo)) { ViewBag.Pic = "http://static.kecq.com/images/common/nopic.jpg"; } var themes = new List <object> { new { themeID = "Default" }, new { themeID = "Cnblogs" }, new { themeID = "Muchun" }, new { themeID = "V2" }, new { themeID = "V3" }, new { themeID = "V4" }, }; //return new JsonNetResult(model, dateTimeFormat: "yyyy-MM-ddThh:mm"); return(new JsonNetResult(new { code = 1, message = "ok", data = m, themes = themes })); }
public ActionResult Edit(string id) { Category m = new Category { categoryID = Convert.ToInt32(id), ADD_DATE = DateTime.Now, UPDATE_DATE = DateTime.Now }; if ((!String.IsNullOrEmpty(id)) && id.ToString() != "0") { blog_tb_category model = Utility.CategoryBll.GetEntity(id); m = ObjectHelper.CloneProperties <Category>(model); } return(View("~/Views/" + Utility.Version + "/Cate/Edit.cshtml", m)); }
public ActionResult Edit(string id) { Menu m = new Menu { ADD_DATE = DateTime.Now, UPDATE_DATE = DateTime.Now }; if ((!String.IsNullOrEmpty(id)) && id.ToString() != "0") { blog_tb_menu model = Utility.MenuBll.GetEntity(id); m = ObjectHelper.CloneProperties <Menu>(model); } return(View("~/Views/" + Utility.Version + "/Menu/Edit.cshtml", m)); }
public ActionResult Edit(string id) { blog_tb_link model = new blog_tb_link { ADD_DATE = DateTime.Now, UPDATE_DATE = DateTime.Now }; if ((!String.IsNullOrEmpty(id)) && id.ToString() != "0") { model = Utility.LinkBll.GetEntity(id); model.UPDATE_DATE = DateTime.Now; } Models.Link m = ObjectHelper.CloneProperties <Models.Link>(model); return(View("~/Views/" + Utility.Version + "/Link/Edit.cshtml", m)); }
public ActionResult ueditorEdit(int id) { var model = Utility.ArticleBll.GetEntity(id + ""); blog_tb_article_content contentModel = Utility.ArticleBll.GetArticleContent(id + ""); //加载临时正文 string tempContent = Utility.ArticleBll.ReadTempContent(id + ""); if (!String.IsNullOrEmpty(tempContent)) { contentModel.articleContent = tempContent; } ViewData["content"] = contentModel; ArticleViewModel m = ObjectHelper.CloneProperties <ArticleViewModel>(model); return(View("~/Views/" + Utility.Version + "/Article/ueditorEdit.cshtml", m)); }
// GET: /BlogManager/Edit/5 public ActionResult Edit(string id) { blog_tb_blog entity = Utility.BlogBll.GetSingleBlogByUserID(UserInfo.UserID); if (entity == null) { throw new CustomException("你还没有创建博客"); } if (Convert.ToInt32(id) != entity.blogID) { return(Json(new { code = -1, message = "你无权操作该博客" }, JsonRequestBehavior.AllowGet)); } Blog m = ObjectHelper.CloneProperties <Blog>(entity); ViewBag.Pic = m.blogLogo; if (String.IsNullOrEmpty(m.blogLogo)) { ViewBag.Pic = "http://static.kecq.com/images/common/nopic.jpg"; } return(View("~/Views/" + Utility.Version + "/BlogManager/Edit.cshtml", m)); }
public ActionResult Edit(string id) { if (id == null) { return(null); } int objectID = 0; int blogID = Convert.ToInt32(UserInfo.BlogID); blog_tb_article model = new blog_tb_article { blogID = blogID, ADD_DATE = DateTime.Now, UPDATE_DATE = DateTime.Now, articleDatetime = DateTime.Now }; if ((!String.IsNullOrEmpty(id)) && id.ToString() != "0") { //model = Utility.ArticleBll.GetEntity(id); objectID = Convert.ToInt32(id); model = Utility.ArticleBll.GetEntity(id); string tagString = ""; foreach (var item in Utility.ArticleBll.GetArticleTags(id)) { tagString += item.tagDisplay + ","; } tagString = tagString.TrimEnd(','); ViewData["tagString"] = tagString; model.UPDATE_DATE = DateTime.Now; blog_tb_article_content contentModel = Utility.ArticleBll.GetArticleContent(id); //加载临时正文 string tempContent = Utility.ArticleBll.ReadTempContent(id); if (!String.IsNullOrEmpty(tempContent)) { //contentModel.articleContent = tempContent; } ViewData["content"] = contentModel; } else { string lastArticleID = Utility.ArticleBll.LoadLastArticleID(); if (!String.IsNullOrEmpty(lastArticleID)) { objectID = Convert.ToInt32(lastArticleID); string tempContent = Utility.ArticleBll.ReadTempContent(lastArticleID); blog_tb_article_content contentModel = new blog_tb_article_content(); contentModel.articleContent = tempContent; contentModel.UPDATE_DATE = DateTime.Now; ViewData["content"] = contentModel; } else { objectID = Convert.ToInt32(Utility.ArticleBll.NewID()); } } string userID = UserInfo.UserID; var categorys = Utility.CategoryBll.GetTreeData(UserInfo.BlogID); var topics = Utility.TopicBll.GetTopic(blogID + ""); var tags = Utility.TagBll.GetTags(blogID + ""); var siteCategorys = Utility.BlogBll.QuerySiteCategory(); ViewData["categorySelect"] = new SelectList(categorys, "categoryID", "TextWithTreeSpace"); ViewData["TopicSelect"] = new SelectList(topics, "topicID", "topicDisplay"); ViewData["TagSelect"] = new SelectList(tags, "tagID", "tagDisplay"); ViewData["siteCategorySelect"] = new SelectList(siteCategorys, "ID", "Display"); if (tags.Count() > 0) { } ViewData["objectID"] = objectID; ArticleViewModel m = ObjectHelper.CloneProperties <ArticleViewModel>(model); m.IsDisableComment = Utility.CommentBll.isDisableComment(model.articleCommentLimit); m.IsDisabledAnonymouComment = Utility.CommentBll.isDisabledAnonymousComment(model.articleCommentLimit); m.IsVerifyComment = Utility.CommentBll.isVerifyComment(model.articleCommentLimit); IList <blog_attachment> filelist = Utility.ArticleBll.GetFileRelation(id, "attachment"); if (filelist.Count > 0) { List <Models.Attachment> atts = new List <Models.Attachment>(); foreach (var v in filelist) { atts.Add(new Models.Attachment() { fileUrl = v.fileUrl, fileSize = v.fileSize }); } m.AttachmentCollection = atts; } //DataTable dt = FYJ.Common.JsonHelper.JsonToDataTable(json); //if (dt != null && dt.Rows.Count > 0) //{ // foreach (DataRow dr in dt.Rows) // { // str += "<p><a href='" + dr["fileUrl"] + "' target='_blank'>" + dr["fileName"] + "</a></p>"; // } //} if (Request["v"] == "simple") { return(View("~/Views/" + Utility.Version + "/Article/Edit-simple.cshtml", m)); } else if (Request["v"] == "property") { return(View("~/Views/" + Utility.Version + "/Article/Edit-property.cshtml", m)); } return(View("~/Views/" + Utility.Version + "/Article/Edit.cshtml", m)); }