Esempio n. 1
0
        public async Task <IActionResult> OnPostAsync(string slug)
        {
            Article = await _articleRepo.GetArticleWithHistoriesBySlug(slug);

            var histories = Article.History
                            .Where(h => Compare.Any(c => c == h.Version.ToString()))
                            .OrderBy(h => h.Version)
                            .ToArray();

            this.DiffModel = new SideBySideDiffBuilder(new DiffPlex.Differ())
                             .BuildDiffModel(histories[0].Content, histories[1].Content);


            return(Page());
        }
Esempio n. 2
0
        public async Task <IActionResult> OnPost(string slug)
        {
            if (Compare.Count() < 2)
            {
                return(Page());
            }

            var qry = new GetArticleWithHistoriesBySlugQuery(slug);

            var article = await _mediator.Send(qry);

            var histories = article.History
                            .Where(h => Compare.Any(c => c == h.Version.ToString()))
                            .OrderBy(h => h.Version)
                            .ToArray();

            DiffModel = new SideBySideDiffBuilder(new DiffPlex.Differ())
                        .BuildDiffModel(histories[0].Content ?? "", histories[1].Content ?? "");

            Article = _mapper.Map <ArticleHistory>(article);

            return(Page());
        }