コード例 #1
0
        /// <summary>
        ///  ArticleInfo() method
        ///  returns view of
        ///  the article with tags
        /// </summary>
        /// <param name="id">Article Id</param>
        public ActionResult ArticleInfo(int id)
        {
            Article             article    = db.Articles.Get(id);
            ArticleTagViewModel articleTag = new ArticleTagViewModel();

            articleTag.Article = article;

            Tag tag;

            foreach (var t in article.TagArticles)
            {
                tag = db.Tags.Get(t.TagID);
                articleTag.Tags.Add(tag);
            }
            if (article == null)
            {
                return(HttpNotFound());
            }
            return(View(articleTag));
        }
コード例 #2
0
 public IActionResult GetTagsByAIAnync([FromBody] ArticleTagViewModel model)
 => TryCatchR(() => _baiduNaturalLanguageRecognizer.TopicTag(model.Title, model.Content).Items.Select(x => x.Tag));