Exemplo n.º 1
0
        public async System.Threading.Tasks.Task AddStudentToSubject(int subjectId, int studentId)
        {
            N_To_N_StudentSubject record = new N_To_N_StudentSubject {
                StudentId = studentId, SubjectId = subjectId
            };

            await _dataBaseContext.N_To_N_StudentSubject.AddAsync(record);

            await _dataBaseContext.SaveChangesAsync();
        }
Exemplo n.º 2
0
        public void DeleteStudentFromSubject(int subjectId, int studentId)
        {
            N_To_N_StudentSubject m = _dataBaseContext.N_To_N_StudentSubject.FirstOrDefault(x => x.SubjectId == subjectId && x.StudentId == studentId);


            if (m != null)
            {
                _dataBaseContext.N_To_N_StudentSubject.Remove(m);
                _dataBaseContext.SaveChanges();
            }
        }