// to do GetAll?
        public CourseAssignment AddCourseAssignment(CourseAssignment assignment, int CourseId)
        {
            var course = context.Courses
                         .Include(c => c.CourseAssignments)
                         .SingleOrDefault(Course => Course.Id == CourseId);

            course.CourseAssignments.Add(assignment);
            context.SaveChanges();
            return(assignment);
        }
Exemplo n.º 2
0
        public Student AddStudent(string name, string number, string city)
        {
            Student student = new Student()
            {
                Name = name, Number = number, City = city
            };

            context.Students.Add(student);
            context.SaveChanges();
            return(student);
        }
Exemplo n.º 3
0
        public Teacher AddTeacher(string name, string discription)
        {
            Teacher teacher = new Teacher()
            {
                Name = name, Description = discription
            };

            context.Teachers.Add(teacher);
            context.SaveChanges();
            return(teacher);
        }
Exemplo n.º 4
0
        public Course AddCourse(string name, string discription)
        {
            Course course = new Course()
            {
                Name        = name,
                Description = discription
            };

            context.Courses.Add(course);
            context.SaveChanges();
            return(course);
        }