Exemplo n.º 1
0
        public WikiArticleInfoViewModel(
            RequestContext requestContext,
            ArticleId articleId,
            UserManager <WikiDownUser> userManager)
            : base(requestContext, articleId, activeTab: HeaderTab.Info)
        {
            if (userManager == null)
            {
                throw new ArgumentNullException("userManager");
            }

            if (this.Article == null)
            {
                throw new ArticleNotFoundException("articleId");
            }

            this.userManager = userManager;

            this.ActiveArticleRevisionId = this.Article.ActiveRevisionId;

            var redirects = CurrentRepository.GetArticleRedirectsList(articleId);

            this.Redirects = redirects.Select(x => new KeyValuePair <string, string>(x.Slug, x.Title)).ToList();

            this.Tags = (this.Article.Tags ?? Enumerable.Empty <string>()).ToList();

            var articleRevisions = CurrentRepository.GetArticleRevisionsList(articleId);

            this.Revisions = articleRevisions.Select(x => new ArticleRevisionListItem(x, this.userManager)).ToList();
        }