public async Task <Response> FindById(int id) { Doctor result = await _doctorRepository.FindById(id); if (result != null) { return(new Response { IsSuccess = true, Message = Messages.Found.ToString(), Result = result }); } else { return(new Response { IsSuccess = false, Message = Messages.NotFound.ToString() }); } }
public bool MakeAppointment(int patientId, int doctorId, int departmentId, string date) { Appointment appointment = new Appointment(); appointment.Doctor = doctorRepo.FindById(doctorId); appointment.Patient = patientRepo.FindById(patientId); appointment.Department = departmentRepo.FindById(departmentId); appointment.Timestamp = Convert.ToDateTime(date); try { appointmentRepo.Add(appointment); return(true); } catch (Exception) { return(false); } }
public async Task <DoctorDto> Get(int doctorId) { return(_mapper.ToDto(await _doctorRepository.FindById(doctorId))); }