Exemple #1
0
    protected void DeleteMovie(object sender, EventArgs e)
    {
        var repository = new MovieRepository();
        var movie      = repository.Movies
                         .OrderBy(m => m.MovieID)
                         .Skip(1)
                         .First();

        while (movie.Reviews.Count > 0)
        {
            repository.DeleteObject(movie.Reviews.First());
        }
        repository.DeleteObject(movie);
        repository.SaveChanges();
        _movieGrid.DataBind();
    }