Exemple #1
0
        public Teacher Create(Teacher teacher)
        {
            _dBContextSchool.Teacher.Add(teacher);
            _dBContextSchool.SaveChanges();

            return(teacher);
        }
        public Student Create(Student student)
        {
            _dBContextSchool.Student.Add(student);
            _dBContextSchool.SaveChanges();

            return(student);
        }
Exemple #3
0
        public static void init(DBContextSchool context)
        {
            context.Database.EnsureCreated();

            if (context.Student.Any())
            {
                return;
            }
            else
            {
                context.Add(new Student());

                context.SaveChanges();
            }
        }
Exemple #4
0
        public List <Course> GetCourses()
        {
            _dBContextSchool.SaveChanges();

            return(_dBContextSchool.Course.ToList());
        }