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;
    }
	
	

}

@@ -930,13 +930,413 @@
     %7D%0A%09%0A
+%09@RequestMapping(value=%22/test%22,method = RequestMethod.GET)%0A    public @ResponseBody Map%3CString,String%3E addTest()%7B%0A        %09System.out.println(%22Inside AppointmentController POST TEST%22);%0A%09%09  %0A%09    %09Map%3CString,String%3E map=new HashMap%3C%3E();%0A%09%09  if(appointmentService.add(appointment))%7B%0A      %09%09%09map.put(%22result%22,%22success%22);%0A%09%09  %7D%0A%09    %09else%7B%0A%09%09%09map.put(%22result%22,%22failed%22);%0A%09%09%7D%0A%09%09  return map;%0A    %7D%0A%09%0A%09%0A%09%0A
 %09%0A%0A%7D%0A

Update AppointmentController.java