package asa.controller;

import asa.bean.Appointment;
import asa.service.AppointmentService;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.MediaType;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;

@RestController
@RequestMapping("/appointment")
public class AppointmentController {

	@Autowired
	private AppointmentService appointmentService;
	
	@RequestMapping(method = RequestMethod.GET)
	public void view(){
		System.out.println("Inside AppointmentController");
	}
	
    @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody Map<String,String> add(@RequestBody Appointment appointment){
        
		  Map<String,String> map=new HashMap<>();
		  if(appointmentService.add(appointment)){
      			map.put("result","success");
		  }
	    	else{
			map.put("result","failed");
		}
		  return map;
    }
	/*
	@RequestMapping(value="/test",method = RequestMethod.GET)
    public @ResponseBody Map<String,String> addTest(){
        	System.out.println("Inside AppointmentController POST TEST");
		  
	    	Map<String,String> map=new HashMap<>();
		  if(appointmentService.add(appointment)){
      			map.put("result","success");
		  }
	    	else{
			map.put("result","failed");
		}
		  return map;
    }
	*/
	
	
	
	

}

@@ -468,12 +468,26 @@
 lic 
-void
+Collection%3CObject%3E
  vie
@@ -545,16 +545,132 @@
 ller%22);%0A
+%09%09Collection%3CObject%3E list= appointmentService.get();%0A%09%09System.out.println(%22Length :%22list.size());%0A%09%09return list;%0A%09%09%0A
 %09%7D%0A%09%0A   

Update AppointmentController.java