public async Task <IActionResult> UpdateSubject(int id, [FromBody] SubjectEditModel subjectForUpdate)
        {
            var subject = await _quantumITAppService.UpdateSubjectAsync(id, subjectForUpdate);

            return(Ok(subject));

            throw new Exception($"updating subject {id} failed on save!");
        }
Esempio n. 2
0
        public async Task <IActionResult> UpdateSubject(int id, [FromBody] SubjectEditModel subjectForUpdate)
        {
            var subject = await _quantumITAppService.UpdateSubjectAsync(id, subjectForUpdate);

            if (!subject)
            {
                return(BadRequest("Subject with this name already exists!"));
            }
            return(Ok(subject));
        }