Exemple #1
0
        public async Task <IActionResult> AssignManyStudentsToManyGroupAsync([FromBody] STGAssignmentDTO assignmentDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            await _service.AssignManyStudentsToManyGroupAsync(assignmentDTO);

            return(Ok());
        }
Exemple #2
0
        public async Task AssignManyStudentsToManyGroupAsync(STGAssignmentDTO assignmentDTO)
        {
            GroupAssignmentAddDTO stgAssignment = new GroupAssignmentAddDTO();

            foreach (var group in assignmentDTO.GroupIds)
            {
                foreach (var student in assignmentDTO.StudentIds)
                {
                    stgAssignment.UserId  = student;
                    stgAssignment.GroupId = group;
                    await AssignStudentsToGroupAsync(stgAssignment);

                    stgAssignment = new GroupAssignmentAddDTO();
                }
            }
        }