예제 #1
0
        public async Task <Doctor> AddNewDoctor(AddNewDoctorRequest request)
        {
            var doctor = _mapper.Map <Doctor>(request);

            doctor.Id = newDoctorID();
            _unitOfWork.GetRepository <Doctor>().Add(doctor);
            await _unitOfWork.CommitAsync();

            return(doctor);
        }
예제 #2
0
        public IActionResult addDoctor(AddNewDoctorRequest request)
        {
            DTO.Responses.AddNewDoctorResponse response = new AddNewDoctorResponse();
            response.Id        = _DbService.GetDoctors().Count();
            response.LastName  = request.LastName;
            response.FirstName = request.FirstName;
            response.Email     = request.Email;
            _DbService.AddDoctor(response);

            return(Ok("Dodano lekarza jakim jest: " + response.FirstName + " " + response.LastName));
        }
예제 #3
0
        public string AddNewDoctor(AddNewDoctorRequest request)
        {
            var doctor = new Doctor
            {
                FirstName = request.FirstName,
                LastName  = request.LastName,
                Email     = request.Email,
            };

            _context.Attach(doctor);
            _context.Add(doctor);
            _context.SaveChangesAsync();

            return("Doctor added");
        }
예제 #4
0
        public IActionResult AddDoctor([FromBody] AddNewDoctorRequest request)
        {
            if (_context.ContainsDoctor(request.Name, request.LastName))
            {
                return(BadRequest("Taki lekarz juz istnieje w bazie"));
            }

            _context.AddDoctor(new Doctor
            {
                FirstName = request.Name,
                LastName  = request.LastName,
                Email     = request.Email
            });

            return(Ok("Dodano nowego doktora"));
        }
예제 #5
0
 public IActionResult AddDoctor(AddNewDoctorRequest request)
 {
     return(Ok(_context.AddNewDoctor(request)));
 }
        public async Task <IActionResult> AddNewPatient(AddNewDoctorRequest request)
        {
            var response = await _shiftService.AddNewDoctor(request);

            return(Ok(new ApiOkResponse(response)));
        }