Example #1
0
 private void DeleteBlog()
 {
     if (Repository.Delete(SelectedBlog))
     {
         Blogs.Remove(SelectedBlog);
     }
 }
Example #2
0
 public void RemoveBlog()
 {
     if (CurrentBlog != null)
     {
         Blogs.Remove(CurrentBlog);
     }
 }
Example #3
0
        public static void Background()
        {
            "Given a global administrator named \"Greg\""
            .Given(() => Users.Save(new GlobalAdministrator {
                Name = "Greg", Password = "******"
            }))
            .Teardown(() => Users.Remove("Greg"));

            "And a blog named \"Greg's anti-tax rants\" owned by \"Greg\""
            .And(() => Blogs.Save(new Blog {
                Name = "Greg's anti-tax rants", Owner = Users.Get("Greg")
            }))
            .Teardown(() => Blogs.Remove("Greg's anti-tax rants"));

            "And a customer named \"Dr. Bill\""
            .And(() => Users.Save(new Customer {
                Name = "Dr. Bill", Password = "******"
            }))
            .Teardown(() => Users.Remove("Dr. Bill"));

            "And a blog named \"Expensive Therapy\" owned by \"Dr. Bill\""
            .And(() => Blogs.Save(new Blog {
                Name = "Expensive Therapy", Owner = Users.Get("Dr. Bill")
            }))
            .Teardown(() => Blogs.Remove("Expensive Therapy"));
        }
 public void RemoveBlog()
 {
     if (CurrentBlog != null)
     {
         blogService.Remove(CurrentBlog);
         Blogs.Remove(CurrentBlog);
     }
 }
Example #5
0
 public void DeleteEntry(int id)
 {
     foreach (var blogEntry in Blogs.Where(blogEntry => blogEntry.BlogID == id))
     {
         Blogs.Remove(blogEntry);
         break;
     }
 }
Example #6
0
        /// <summary>
        /// Deletes the Blog from the current BlogProvider.
        /// </summary>
        protected override void DataDelete()
        {
            OnSaving(this, SaveAction.Delete);

            if (this.Deleted)
            {
                BlogService.DeleteBlogStorageContainer(this);
                BlogService.DeleteBlog(this);
            }

            Blogs.Remove(this);
            SortBlogs();
            OnSaved(this, SaveAction.Delete);

            this.Dispose();
        }
Example #7
0
        public void DeleteBlog()
        {
            DisplayBlogs();
            Console.WriteLine("Which Blog do you want to delete by ID: ");
            int blogId = Convert.ToInt32(Console.ReadLine());

            var existingBlog = Blogs.Where(b => b.BlogId == blogId).FirstOrDefault();

            if (existingBlog != null)
            {
                Blogs.Remove(existingBlog);
                this.SaveChanges();
            }

            else
            {
                Console.WriteLine("Not a valid ID. Please pick a valid ID");
                DeleteBlog();
            }
        }