//Inserire record public static void InsertMovie() { CinemaDataContext db = new CinemaDataContext(connectionString); SelectMovies(); var movieToInsert = new Movy(); movieToInsert.Title = "Lalaland"; movieToInsert.Genere = "Musical"; movieToInsert.Durata = 120; db.Movies.InsertOnSubmit(movieToInsert); try { db.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } SelectMovies(); //se lo faccio prima di submit changes non vedo il nuovo film var DeleteMovie = db.Movies.SingleOrDefault(m => m.ID == 9); if (DeleteMovie != null) { db.Movies.DeleteOnSubmit(DeleteMovie); } try { db.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } SelectMovies(); }
partial void DeleteMovy(Movy instance);
partial void UpdateMovy(Movy instance);
partial void InsertMovy(Movy instance);