public void DeleteBlog(int id) { BlogPost toRemove = GetBlog(id); BlogPosts.Remove(toRemove); SaveChanges(); }
public void Delete(Guid uniqueId) { var blogPostToDelete = BlogPosts.FirstOrDefault(i => i.UniqueId == uniqueId); if (blogPostToDelete != null) { BlogPosts.Remove(blogPostToDelete); } }
public void DeleteBlog(int id) { var toRemove = GetBlog(id); if (toRemove == null) { throw new Exception(); } BlogPosts.Remove(toRemove); }
public void UpdateBlog(BlogPost toUpdate) { var toReplace = GetBlog(toUpdate.BlogPostId); if (toReplace == null) { throw new Exception("Blog ID does not exist"); } BlogPosts.Remove(toReplace); BlogPosts.Add(toUpdate); }