コード例 #1
0
        public async Task <IActionResult> AddArticle(AddArticleViewModel model)
        {
            var article = new Article(model.Title, model.Content, model.Author);
            await articleRepository.AddArticleAsync(article);

            var searchModel   = mapper.Map <SearchEngine.SearchModels.Article>(article);
            var indexResponse = await elasticClient.IndexDocumentAsync(searchModel);

            return(Ok());
        }
コード例 #2
0
        public async Task <Article> AddArticleAsync(Article article)
        {
            await _log.WriteAsync(article.Text);

            return(await _articleRepository.AddArticleAsync(article));
        }