コード例 #1
0
        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));
        }
コード例 #2
0
 public ActionResult CreateDoctor(Doctor doctor)
 {
     _repo.CreateDoctor(doctor);
     return(NoContent());
 }