Beispiel #1
0
        private void Remove_Click(object sender, RoutedEventArgs e)
        {
            synchronizer.LoggingMode = true;
            using (var db = new BloggingContext())
            {
                db.Blogs.RemoveRange(Blogs.SelectedItems.Cast<Blog>());
                db.SaveChanges();

                Blogs.ItemsSource = db.Blogs.ToList();
            }
            synchronizer.LoggingMode = false;
        }
Beispiel #2
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            synchronizer.LoggingMode = true;
            using (var db = new BloggingContext())
            {
                var blog = new Blog { BlogId = HashStringToIntId(NewBlogUrl.Text), Url=NewBlogUrl.Text };
                db.Blogs.Add(blog);
                db.SaveChanges();

                Blogs.ItemsSource = db.Blogs.ToList();
            }
            synchronizer.LoggingMode = false;
        }