Пример #1
0
        public IEnumerable <Pupils> Insert()
        {
            var context = new PupilsContext();
            var pupils  = new List <Pupils>()
            {
                new Pupils()
                {
                    ID = 2, FirstName = "Vasya", LastName = "Pupkin", Phone = "0987543222"
                }
            };
            var school = new School()
            {
                Name = "KHNURE", Id = 2
            };
            var teacher = new ClassroomTeacher()
            {
                LastName = "MIchailuk", FirstName = "Ivan", Id = 2
            };


            context.Pupils.AddRange(pupils);
            context.Schools.Add(school);
            context.Teachers.Add(teacher);

            context.SaveChanges();

            return(context.Pupils.ToList());
        }
Пример #2
0
 public Pupils()
 {
     Schools = new School();
     Teacher = new ClassroomTeacher();
 }