/// <summary> /// 当选择系统默认头像时,保存头像 /// </summary> /// <param name="info"></param> public void SaveAvatar(ResourceFileInfo info) { var myArticle = SiteManager.Kernel.Get <EFAuditDataService <Base_Article> >(); Base_Article art = new Base_Article(); art = myArticle.GetQuery().Include(a => a.Exts).FirstOrDefault(a => a.Id == info.Id); Base_Article newart = new Base_Article { EditorId = Convert.ToInt32(info.UserId), Author = info.UserId, Title = info.UserId + "的头像", State = ArticleState.ReadOnly }; var avatarCatId = Catalog.GetAllValid().First(cat => cat.Name == "UserAvatar" && cat.ParentId == Catalog.GetRootId()).Id; Base_CatalogArticle catArt = new Base_CatalogArticle { Article = newart, CatalogId = avatarCatId, ArticleId = newart.Id, }; var rootId = Catalog.GetRootId(); catArt.SetExt(SiteManager.Catalog.GetExtByName(rootId, SystemTypes.Root.Key), art.Exts.FirstOrDefault(e => e.CatlogExtId == SiteManager.Catalog.GetExtByName(rootId, SystemTypes.Root.Key).Id).Value); catArt.SetExt(SiteManager.Catalog.GetExtByName(rootId, SystemTypes.Root.FileName), art.Exts.FirstOrDefault(e => e.CatlogExtId == SiteManager.Catalog.GetExtByName(rootId, SystemTypes.Root.FileName).Id).Value); catArt.SetExt(SiteManager.Catalog.GetExtByName(rootId, SystemTypes.Root.FileSize), art.Exts.FirstOrDefault(e => e.CatlogExtId == SiteManager.Catalog.GetExtByName(rootId, SystemTypes.Root.FileSize).Id).Value); _article.Save(catArt); _article.Dispose(); }
protected override void Dispose(bool disposing) { _article.Dispose(); }
public void Dispose() { _article.Dispose(); }