public async Task <IActionResult> Create(CreateArticleFormModel model) { string content = this.sanitizer.HtmlSanitizer(model.Content); await this.articleService.CreateAsync( content, model.Title, model.Published, this.userManager.GetUserId(this.User)); return(this.RedirectToAction(nameof(HomeController.Index), "Home")); }
//[Authorize(Roles = AdminRole)] public async Task <IActionResult> Create(CreateArticleFormModel model) { if (!ModelState.IsValid) { TempData.AddErrorMessage(ErrorModelState()); return(View(model)); } model.Content = this.html.Sanitize(model.Content); var userId = this.userManager.GetUserId(User); await this.blogArticle.CreateAsync(model.Title, model.Content, userId); return(RedirectToAction(IndexAction, HomeControllerConst, new { area = BlogArea })); }