Ejemplo n.º 1
0
 /// <summary>
 /// 读取json,反序列化为相册图片列表
 /// </summary>
 public List<AlbumImageModel> GetAlbumImageList(string content, out AlbumImageModel cover)
 {
     List<AlbumImageModel> lst = new List<AlbumImageModel>();
     cover = new AlbumImageModel();
     try
     {
         string jsonnav = Utils.RemoveHtml(content).Replace("\n", "").Replace("&nbsp;", "");
         if (jsonnav != "")
         {
             lst = Utils.ParseFromJson<List<AlbumImageModel>>(jsonnav);
             cover = lst.OrderByDescending(m => m.IsCover).FirstOrDefault();
         }
     }
     catch (Exception) { }
     return lst;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 文章对象转换为相册对象
 /// </summary>
 public AlbumModel GetAlbum(blog_varticle varticle)
 {
     AlbumModel album = new AlbumModel();
     AlbumImageModel cover = new AlbumImageModel();
     if (varticle != null)
     {
         album.Id = varticle.id;
         album.ImageList = GetAlbumImageList(varticle.content, out cover);
         album.Cover = cover;
         album.Title = varticle.title;
         album.ReName = varticle.rename;
         album.Description = Utils.RemoveHtml(varticle.summary);
         album.ImgCount = album.ImageList.Count();
         album.CommentCount = varticle.subcount;
         album.ViewCount = varticle.viewcount;
         album.AlbumPath = GetCategoryPathUrl2(varticle.catepath);
         album.AlbumCategory = GetCategoryByID(varticle.cateid).CateName;
         album.Createdate = varticle.createdate;
         album.Favor = varticle.favor;
         album.Against = varticle.against;
         album.Url = varticle.url;
     }
     return album;
 }