public PatientAppointmentVM GetPatientById(string patientId) { using (IDbConnection con = Connection) { con.Open(); PatientAppointmentVM model = new PatientAppointmentVM(); try { string sql = @"select * from AspNetUsers as Asp inner join Appointments as a on a.PatientId=Asp.Id where Asp.Id=@Id"; var patientDetails = con.Query <ApplicationUsers, Appointment, PatientAppointmentVM>(sql, (p, a) => { model.Age = p.Age; model.Height = p.Height; model.Weight = p.Weight; model.Gender = p.Gender; model.Appointment = a; return(model); }, new { @Id = patientId }, splitOn: "Id").FirstOrDefault(); return(patientDetails); } catch (Exception ae) { throw ae; } } }
public ScheduleController(IUnitOfWork unitOfWork) { PatientAppointmentVM = new PatientAppointmentVM(); Appointment Appointment = new Appointment(); PatientAppointmentVM.Appointment = Appointment; _unitOfWork = unitOfWork; }