public ActionResult Article(int id) { Article model = _articleService.GetById(id); if (model == null) { throw new ArgumentException(string.Format("Article with id = {0} was not found", id)); } ArticleVm vm = Mapper.Map <Article, ArticleVm>(model); model.ViewsCount++; _articleService.Update(model); return(View(vm)); }
public ActionResult Create(ArticleVm articleVm) { _articleService.Create(_mapper.Map <Article>(articleVm)); return(RedirectToAction("GetArticles", "Article", new { area = "" })); }