public ActionResult DeletePost(int id) { var postModelFromRepo = _repository.GetPostById(id); if (postModelFromRepo == null) { return(NotFound()); } _repository.DeletePost(postModelFromRepo); _repository.SaveChanges(); return(NoContent()); }