/// <summary> /// 添加新闻 /// </summary> /// <param name="article"></param> /// <param name="relaInfo"></param> public void AddNews(BasicInformation article, Relations relaInfo) { _efDb.Add(article); article.Type = NewsType.TextNews; relaInfo.NewsId = article.ID; _efDb.Add(relaInfo); }
/// <summary> /// 新闻栏目列表 /// </summary> public void AddNewsCategory(NewsCategory category) { if (category.ParentID == null) { category.CategoryPath = category.Name; } else { var parentCategory = GetCategoryById(category.ParentID.Value); if (parentCategory == null) { throw new Exception("未找到父级栏目"); } category.CategoryPath = parentCategory.CategoryPath + ">>" + category.Name; } _efDb.Add(category); }