Ejemplo n.º 1
0
        public async Task<ActionResult> UpdateArticle(UpdateArticleRequest article)
        {
            var model = new UpdateArticleViewModel();

            if (this.ModelState.IsValid)
            {
                await this.blogCommandService.UpdateArticle(article.Id, new UpdateArticleModel
                {
                    Body = article.Body,
                    Header = article.Header,
                    TeaserText = article.TeaserText,
                    AuthorId = this.User.Identity.GetUserId()
                });
                return RedirectToAction("MyArticles");
            }

            model.Article = new UpdateArticleDto
            {
                Id = article.Id,
                Body = article.Body,
                Header = article.Header,
                TeaserText = article.TeaserText
            };

            return View(model);
        }
Ejemplo n.º 2
0
        public async Task<ActionResult> GetForUpdateArtile(int articleId)
        {
            var model = new UpdateArticleViewModel();

            model.Article = await this.blogReadService.GetArticleByIdAsync<UpdateArticleDto>(articleId);

            return View(model);
        }