Exemplo n.º 1
0
        private void InsertButton_Click(object sender, RoutedEventArgs e)
        {
            Review     newReview = new Review();
            EditWindow window    = new EditWindow();

            window.DataContext = newReview;
            if (window.ShowDialog() == true)
            {
                Movie selectedMovie = _moviesList.SelectedItem
                                      as Movie;
                newReview.Movie = selectedMovie;

                _db.Reviews.InsertOnSubmit(newReview);
                _db.SubmitChanges();
                ((IList <Review>)_reviewsList.ItemsSource).Add(newReview);
            }
        }
Exemplo n.º 2
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            Review selectedReivew = _reviewsList.SelectedItem
                                    as Review;
            Review tempReview = new Review
            {
                Body     = selectedReivew.Body,
                Rating   = selectedReivew.Rating,
                Reviewer = selectedReivew.Reviewer,
                Summary  = selectedReivew.Summary
            };
            EditWindow window = new EditWindow();

            window.DataContext = tempReview;
            if (window.ShowDialog() == true)
            {
                selectedReivew.Body     = tempReview.Body;
                selectedReivew.Rating   = tempReview.Rating;
                selectedReivew.Reviewer = tempReview.Reviewer;
                selectedReivew.Summary  = tempReview.Summary;
                _db.SubmitChanges();
            }
        }