public bool EditBlog(BlogSetting currentBlog) { var blogs = GetBlogs(); var blogToUpdate = blogs.SingleOrDefault(b => SameBlog(currentBlog, b)); currentBlog.BeginEdit(); var blogSettings = blogSettingsCreator(); blogSettings.InitializeBlog(currentBlog); var result = windowManager.ShowDialog(blogSettings); if (result != true) { currentBlog.CancelEdit(); return(false); } var index = blogs.IndexOf(blogToUpdate); blogs[index] = currentBlog; currentBlog.EndEdit(); SaveBlogs(blogs); return(true); }
public BlogSetting AddBlog() { var blog = new BlogSetting { BlogName = "New", Language = "HTML" }; blog.BeginEdit(); var blogSettings = blogSettingsCreator(); blogSettings.InitializeBlog(blog); var result = windowManager.ShowDialog(blogSettings); if (result != true) { blog.CancelEdit(); return(null); } blog.EndEdit(); var blogs = GetBlogs(); blogs.Add(blog); SaveBlogs(blogs); return(blog); }
public BlogSetting AddBlog() { var blog = new BlogSetting { BlogName = "New", Language = "HTML" }; blog.BeginEdit(); var blogSettings = blogSettingsCreator(); blogSettings.InitializeBlog(blog); var result = windowManager.ShowDialog(blogSettings); if (result != true) { blog.CancelEdit(); return null; } blog.EndEdit(); var blogs = GetBlogs(); blogs.Add(blog); SaveBlogs(blogs); return blog; }
public bool EditBlog(BlogSetting currentBlog) { var blogs = GetBlogs(); var blogToUpdate = blogs.SingleOrDefault(b => SameBlog(currentBlog, b)); currentBlog.BeginEdit(); var blogSettings = blogSettingsCreator(); blogSettings.InitializeBlog(currentBlog); var result = windowManager.ShowDialog(blogSettings); if (result != true) { currentBlog.CancelEdit(); return false; } var index = blogs.IndexOf(blogToUpdate); blogs[index] = currentBlog; currentBlog.EndEdit(); SaveBlogs(blogs); return true; }