예제 #1
0
        public async Task AddStudentModuleAsync(StudentModuleDto studentModuleDto)
        {
            if (studentModuleDto == null)
            {
                throw new ArgumentNullException();
            }

            context.StudentModules.Add(studentModuleDto.ToStudentModule());

            await context.SaveChangesAsync();
        }
예제 #2
0
        public async Task DeleteStudentModuleAsync(int id)
        {
            StudentModuleDto studentModule = (await context.StudentModules.FindAsync(id)).ToStudentModuleDto();

            if (studentModule == null)
            {
                throw new ArgumentException("No studentModule with such id found");
            }

            context.StudentModules.Remove(studentModule.ToStudentModule());
            await context.SaveChangesAsync();
        }