public ActionResult Index(ArticleContainerViewModel viewModel) { if (this.ModelState.IsValid) { this.articleService.AddArticle(viewModel.CreateArticle.Author, viewModel.CreateArticle.Title, viewModel.CreateArticle.Content); return(this.RedirectToAction("Index")); } return(this.View(viewModel)); }
public ActionResult DeleteArticle() { var articles = this.articleService .ListAllArticles() .Select(a => new ArticleViewModel { Id = a.Id, Author = a.Author, Title = a.Title }) .ToList(); ArticleContainerViewModel viewModel = new ArticleContainerViewModel() { CreateArticle = new ArticleViewModel(), Articles = articles }; return(View(viewModel)); }