public async Task <ActionResult> DeletePost(int id) { var post = await _services.GetPost(id); if (post == null) { return(NotFound()); } await _services.DeletePost(post); _services.DeleteImage(post.imageName); return(Redirect("/")); }