Beispiel #1
0
        public async Task <IActionResult> AddStudentToClass(StudentToClassDto studentToClass)
        {
            Student student        = _studentRepo.GetStudent(studentToClass.StudentId);
            String  classValidator = await ClassValidator(studentToClass.ClassId);

            if (student == null)
            {
                return(BadRequest("Student do not exist"));
            }

            if (classValidator != "Valid Class")
            {
                return(BadRequest(classValidator));
            }

            return((_studentRepo.AddStudentToClass(student, studentToClass.ClassId) != null) ? StatusCode(202) : BadRequest());
        }