22
33import java .text .SimpleDateFormat ;
44import java .util .Date ;
5+ import java .util .List ;
56
67import org .springframework .beans .factory .annotation .Autowired ;
78import org .springframework .security .core .context .SecurityContextHolder ;
89import org .springframework .security .core .userdetails .UserDetails ;
910import org .springframework .stereotype .Controller ;
11+ import org .springframework .ui .Model ;
1012import org .springframework .web .bind .annotation .RequestMapping ;
1113
1214import com .spring .bioMedical .entity .Admin ;
15+ import com .spring .bioMedical .entity .Appointment ;
1316import com .spring .bioMedical .service .AdminServiceImplementation ;
17+ import com .spring .bioMedical .service .AppointmentServiceImplementation ;
1418import com .spring .bioMedical .service .UserService ;
1519
1620@ Controller
@@ -21,17 +25,23 @@ public class DoctorController {
2125
2226 private AdminServiceImplementation adminServiceImplementation ;
2327
28+ private AppointmentServiceImplementation appointmentServiceImplementation ;
29+
30+
2431 @ Autowired
25- public DoctorController (UserService userService ,AdminServiceImplementation obj ) {
32+ public DoctorController (UserService userService ,AdminServiceImplementation obj ,
33+ AppointmentServiceImplementation app ) {
2634 this .userService = userService ;
2735 adminServiceImplementation =obj ;
28-
36+ appointmentServiceImplementation = app ;
2937 }
3038
3139
3240 @ RequestMapping ("/index" )
33- public String index (){
41+ public String index (Model model ){
3442
43+
44+
3545 // get last seen
3646 String username ="" ;
3747 Object principal = SecurityContextHolder .getContext ().getAuthentication ().getPrincipal ();
@@ -58,6 +68,13 @@ public String index(){
5868 adminServiceImplementation .save (admin );
5969
6070
71+
72+ List <Appointment > list =appointmentServiceImplementation .findAll ();
73+
74+
75+
76+ // add to the spring model
77+ model .addAttribute ("app" , list );
6178
6279 return "doctor/index" ;
6380 }
0 commit comments