Esempio n. 1
0
        public async Task <IActionResult> AddSpecialty(long id, DoctorSpecialty specialty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!await _repository.Exists(id) || !await _specialtyGetter.Exists(specialty.SpecialtyId) ||
                specialty.DoctorId != id)
            {
                return(BadRequest());
            }

            return(Ok(await _specialtyRepository.Post(specialty)));
        }