コード例 #1
0
ファイル: HelpController.cs プロジェクト: MaximFil/Parser
        public ArticleViewModel GetArticle(int idLastArticle, int idSite)
        {
            var     articleSite = new ArticleViewModel();
            Article article;

            using (_context)
            {
                var showArticle = _userRepository.GetUserViewSetting();
                var userId      = _userRepository.GetUserId();
                if (showArticle)
                {
                    article = _articleRepository.GetShowArticle(idSite, idLastArticle, userId);
                }
                else
                {
                    article = _articleRepository.GetAllArticle(idSite, idLastArticle, userId);
                }
                if (article != null)
                {
                    articleSite =
                        new ArticleViewModel
                    {
                        FullContent = article.Content,
                        Link        = article.Url,
                        PartContent = article.PartContent,
                        Title       = article.Title,
                        Id          = article.Id
                    };
                }
            }
            return(articleSite);
        }