public ActionResult ArticlesUpdate([DataSourceRequest]DataSourceRequest request, ArticleAdminViewModel article)
        {
            if (ModelState.IsValid && article != null)
            {
                var updated = AutoMapper.Mapper.Map<Article>(article);

                updated.UserId = this.CurrentUser.Id;
                var updatedmodel = this.articlesService
                    .UpdateArticle(updated)
                    .ProjectTo<ArticleAdminViewModel>()
                    .FirstOrDefault();
            }

            return Json(new[] { article }.ToDataSourceResult(request, ModelState));
        }
        public ActionResult ArticlesCreate([DataSourceRequest]DataSourceRequest request, ArticleAdminViewModel article)
        {
            if (ModelState.IsValid && article != null)
            {
                var newArticle = Mapper.Map<Article>(article);

                newArticle.UserId = this.CurrentUser.Id;

                var result = this.articlesService.AddArticle(newArticle);

                Mapper.Map(result, article);
            }

            return Json(new[] { article }.ToDataSourceResult(request, ModelState));
        }
        public ActionResult ArticlesDestroy([DataSourceRequest]DataSourceRequest request, ArticleAdminViewModel article)
        {
            if (ModelState.IsValid && article != null)
            {
                this.articlesService.DeleteArticle(article.Id);
            }

            return Json(new[] { article }.ToDataSourceResult(request, ModelState));
        }
        public ActionResult ArticlesDestroy([DataSourceRequest] DataSourceRequest request, ArticleAdminViewModel article)
        {
            if (ModelState.IsValid && article != null)
            {
                this.articlesService.DeleteArticle(article.Id);
            }

            return(Json(new[] { article }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult ArticlesUpdate([DataSourceRequest] DataSourceRequest request, ArticleAdminViewModel article)
        {
            if (ModelState.IsValid && article != null)
            {
                var updated = AutoMapper.Mapper.Map <Article>(article);

                updated.UserId = this.CurrentUser.Id;
                var updatedmodel = this.articlesService
                                   .UpdateArticle(updated)
                                   .ProjectTo <ArticleAdminViewModel>()
                                   .FirstOrDefault();
            }

            return(Json(new[] { article }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult ArticlesCreate([DataSourceRequest] DataSourceRequest request, ArticleAdminViewModel article)
        {
            if (ModelState.IsValid && article != null)
            {
                var newArticle = Mapper.Map <Article>(article);

                newArticle.UserId = this.CurrentUser.Id;

                var result = this.articlesService.AddArticle(newArticle);

                Mapper.Map(result, article);
            }

            return(Json(new[] { article }.ToDataSourceResult(request, ModelState)));
        }