Пример #1
0
        public void InsertStudent()
        {
            University     yale      = dataContext.Universities.First(un => un.Name.Equals("Yale"));
            University     cambridge = dataContext.Universities.First(un => un.Name.Equals("Cambridge"));
            List <Student> students  = new List <Student>();

            students.Add(new Student {
                Name = "Peem", Gender = "male", UniversityId = cambridge.Id
            });
            students.Add(new Student {
                Name = "Jame", Gender = "trans-gender", UniversityId = yale.Id
            });
            students.Add(new Student {
                Name = "Judith", Gender = "female", University = cambridge
            });
            dataContext.Students.InsertAllOnSubmit(students);
            dataContext.SubmitChanges();
            MainDataGrid.ItemsSource = dataContext.Students;
        }
Пример #2
0
        // insert universities into database
        public void InsertUniversities()
        {
            // delete all entries
            dataContext.ExecuteCommand("delete from University");

            University yale   = new University();
            University mizzou = new University();

            yale.Name   = "Yale";
            mizzou.Name = "Mizzou";
            // prepare data to be submitted to database
            dataContext.Universities.InsertOnSubmit(yale);
            dataContext.Universities.InsertOnSubmit(mizzou);

            // submit
            dataContext.SubmitChanges();

            // display data in the MainDataGrid
            MainDataGrid.ItemsSource = dataContext.Universities;
        }
Пример #3
0
 partial void DeleteUniversity(University instance);
Пример #4
0
 partial void UpdateUniversity(University instance);
Пример #5
0
 partial void InsertUniversity(University instance);