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); }
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)); }
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"); }
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")); }
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))); }