Exemple #1
0
        public ActionResult DeletePost(int id)
        {
            var postModelFromRepo = _repository.GetPostById(id);

            if (postModelFromRepo == null)
            {
                return(NotFound());
            }
            _repository.DeletePost(postModelFromRepo);
            _repository.SaveChanges();

            return(NoContent());
        }