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 @ResponseBody Map<String,String> view(){
		Map<String,String> map=new HashMap<>();
		System.out.println("Inside AppointmentController");
		List<Appointment> list= appointmentService.get();
		System.out.println("Length :"+list.size());
		
		if(list.size()==0){
			map.put("result","success");
			map.put("list",list);
		}
		else{
			map.put("result","failed");
		}
			
		return map;
	}
	
    @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;
    }
	*/
	
	
	
	

}

@@ -489,22 +489,22 @@
 %3CString,
-String
+Object
 %3E view()
@@ -736,32 +736,43 @@
 ap.put(%22result%22,
+new String(
 %22success%22);%0A%09%09%09m
@@ -761,24 +761,25 @@
 g(%22success%22)
+)
 ;%0A%09%09%09map.put
@@ -817,32 +817,43 @@
 ap.put(%22result%22,
+new String(
 %22failed%22);%0A%09%09%7D%0A%09
@@ -837,32 +837,33 @@
 String(%22failed%22)
+)
 ;%0A%09%09%7D%0A%09%09%09%0A%09%09retu

Update AppointmentController.java