public async Task <DoctorDTO> PatchAsync(DoctorUpdateDTO doctor)
        {
            this.Logger.LogTrace($"{nameof(this.PutAsync)} called");
            var result = await this.DoctorService.UpdateAsync(this.Mapper.Map <DoctorUpdateModel>(doctor));

            return(this.Mapper.Map <DoctorDTO>(result));
        }
Esempio n. 2
0
        public ActionResult UpdateDoctor(int id, DoctorUpdateDTO doctorUpdateDTO)
        {
            var doctorFromRepo = _repository.GetDoctorById(id);

            if (doctorFromRepo == null)
            {
                return(NotFound());
            }

            _mapper.Map(doctorUpdateDTO, doctorFromRepo);

            _repository.UpdateDoctor(doctorFromRepo);

            _repository.SaveChanges();

            return(NoContent());
        }