public ActionResult ShowBookmarkHTML(long bookmarkID, string url) { UIBookmarkInfo model = null; if (bookmarkID == 0 || string.IsNullOrEmpty(url)) { return(PartialView("ShowBookmarkHTML", model)); } var bookmarkInfo = BizBookmarkInfo.LoadByID(bookmarkID); if (bookmarkInfo == null) { return(PartialView("ShowBookmarkHTML", model)); } model = new UIBookmarkInfo(); model.IsShowWithiframe = bookmarkInfo.IsShowWithiframe == 1;//是否可在iframe中展示 if (string.IsNullOrEmpty(bookmarkInfo.HTML)) { var result = HTTPHelper.GetHTML(url); if (string.IsNullOrEmpty(result.Item1)) { model = new UIBookmarkInfo(); model.HTML = bookmarkInfo.HTML; model.Href = bookmarkInfo.Href; model.UserInfoID = bookmarkInfo.UserInfoID; model.Host = bookmarkInfo.Host; model.BookmarkName = bookmarkInfo.BookmarkName; model.BookmarkInfoID = bookmarkInfo.BookmarkInfoID; return(PartialView("ShowBookmarkHTML", model)); } bookmarkInfo.HTML = result.Item1; if (string.IsNullOrEmpty(result.Item2) || result.Item2.ToUpper() == "ALLOW-FROM") { bookmarkInfo.IsShowWithiframe = 1; model.IsShowWithiframe = true; } bookmarkInfo.Save(); } model.HTML = bookmarkInfo.HTML; model.Href = bookmarkInfo.Href; model.UserInfoID = bookmarkInfo.UserInfoID; model.Host = bookmarkInfo.Host; model.BookmarkName = bookmarkInfo.BookmarkName; model.BookmarkInfoID = bookmarkInfo.BookmarkInfoID; return(PartialView("ShowBookmarkHTML", model)); }
public ActionResult ConvertToUIBookmarkInfo(string strModel) { UIBookmarkInfo bookmark = null; try { bookmark = JsonConvert.DeserializeObject <UIBookmarkInfo>(strModel); } catch (Exception ex) { LogHelper.WriteException("UIBookmarkInfo反序列化失败", ex, new { Modle = strModel }); } return(Json(bookmark)); }
// // GET: /ShowBookmarkInfo/ public ActionResult Index(long bookmarkID) { if (bookmarkID == 0) { return(View()); } UIBookmarkInfo model = null; var bookmarkInfo = BizBookmarkInfo.LoadByID(bookmarkID); if (bookmarkInfo != null) { bookmarkInfo.LoadBookmarkTagInfo(); bookmarkInfo.LoadLikeLog(); model = new UIBookmarkInfo(); model.LikeCount = bookmarkInfo.LikeCount; model.LikeLogList = bookmarkInfo.LikeLogList; Dictionary <long, BizTagInfo> dicTagInfo = BizTagInfo.LoadByUserID(bookmarkInfo.UserInfoID).ToDictionary(tag => tag.TagInfoID, tag => tag); model.BookmarkInfoID = bookmarkInfo.BookmarkInfoID; model.BookmarkName = bookmarkInfo.BookmarkName; model.Host = bookmarkInfo.Host; model.Href = bookmarkInfo.Href; model.UserInfoID = bookmarkInfo.UserInfoID; model.UserWebFolderID = bookmarkInfo.UserWebFolderID; //model.HTML = bookmarkInfo.HTML; model.CreateTime = bookmarkInfo.CreateTime; var bookmarkUserInfo = BizUserInfo.LoadByUserInfoID(bookmarkInfo.UserInfoID); model.UserInfo = new UIUserInfo() { UserName = bookmarkUserInfo.UserName, UserEmail = bookmarkUserInfo.UserEmail, UserInfoID = bookmarkUserInfo.UserInfoID, }; model.TagInfoList = bookmarkInfo.BizBookmarkTagInfoList.Select(btg => new UIBookmarkTagInfo() { BookmarkTagInfoID = btg.BookmarkTagInfoID, BookmarkInfoID = btg.BookmarkInfoID, TagInfoID = btg.TagInfoID, CreateTime = btg.CreateTime, TagInfo = dicTagInfo.ContainsKey(btg.TagInfoID) ? dicTagInfo[btg.TagInfoID] : null, }).ToList(); } return(View(model)); }