public async Task <DoctorDTO> PutAsync(DoctorCreateDTO doctor) { this.Logger.LogTrace($"{nameof(this.PutAsync)} called"); var result = await this.DoctorService.CreateAsync(this.Mapper.Map <DoctorUpdateModel>(doctor)); return(this.Mapper.Map <DoctorDTO>(result)); }
public ActionResult <DoctorReadDTO> CreateDoctor(DoctorCreateDTO doctorCreateDTO) { var createDoctor = _mapper.Map <Doctor>(doctorCreateDTO); //for creating the doctor if (createDoctor != null) { _repository.CreateDoctor(createDoctor); } else { return(BadRequest(createDoctor)); } _repository.SaveChanges(); //for returining the doctor that was just created var doctorReadDTO = _mapper.Map <DoctorReadDTO>(createDoctor); return(Ok(doctorReadDTO)); }