コード例 #1
0
        public async Task <IActionResult> DisableSubjects(Guid studentId, Guid subjectId)
        {
            if (string.IsNullOrEmpty(studentId.ToString()))
            {
                return(NotFound());
            }
            var student = await _repository.GetStudentAsync(studentId);

            if (student == null)
            {
                return(BadRequest("Student don`t exists"));
            }

            var subject = await _repository.GetSubjectAsync(subjectId);

            if (subject == null)
            {
                return(BadRequest("Subject won`t exists"));
            }
            // disable
            await _repository.DisableSubjectAsync(student.Id, subject.Id);

            await _repository.SaveAsync();

            return(NoContent());
        }