예제 #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());
 }