예제 #1
0
        public ActionResult deleteArticle(int id)
        {
            var article = _articleRepo.GetArticleById(id);

            if (article == null)
            {
                return(NotFound());
            }
            _articleRepo.DeleteArticle(article);
            _articleRepo.SaveChanges();
            return(NoContent());
        }
예제 #2
0
        public ActionResult DeleteArticle(int id)
        {
            var articleModel = _repository.GetArticleById(id);

            if (articleModel == null)
            {
                return(NotFound());
            }

            _repository.DeleteArticle(articleModel);
            _repository.SaveChanges();

            return(NoContent());
        }