/// <summary> /// Delete a post identified by the id. /// </summary> /// <param name="postID">The post ID.</param> public void DeletePost(int postID) { var post = _postsTable.SingleOrDefault(p => p.PostID == postID); if (post != null) { _commentRepository.DeleteCommentsByPostID(postID); _tagRepository.DeleteTagsForPost(postID); _categoryRepository.DeletePostCategoryMapping(postID); _postsTable.DeleteOnSubmit(post); context.SubmitChanges(); } }