protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { using (MovielinqDataContext dbContext = new MovielinqDataContext()) { string deleteID = GridView1.DataKeys[e.RowIndex].Value.ToString(); Movies movie = dbContext.Movies.SingleOrDefault(x => x.Id == deleteID); dbContext.Movies.DeleteOnSubmit(movie); dbContext.SubmitChanges(); GetData(); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { using (MovielinqDataContext dbContext = new MovielinqDataContext()) { string deleteID = GridView1.DataKeys[e.RowIndex].Value.ToString(); Movies movie = dbContext.Movies.SingleOrDefault(x => x.Id == deleteID); dbContext.Movies.DeleteOnSubmit(movie); dbContext.SubmitChanges(); GetData(); } }
protected void LibraryButton3_Click(object sender, EventArgs e) { using (MovielinqDataContext dbContext = new MovielinqDataContext()) { Movies newMovie = new Movies() { Id = movieID3.Text, Title = movieTitle3.Text, ReleaseDate = movieDate3.Text, Popularity = moviePop3.Text, }; dbContext.Movies.InsertOnSubmit(newMovie); dbContext.SubmitChanges(); } }
protected void LibraryButton3_Click(object sender, EventArgs e) { using (MovielinqDataContext dbContext = new MovielinqDataContext()) { Movies newMovie = new Movies() { Id = movieID3.Text, Title = movieTitle3.Text, ReleaseDate = movieDate3.Text, Popularity = moviePop3.Text, }; dbContext.Movies.InsertOnSubmit(newMovie); dbContext.SubmitChanges(); } }