package com.exactsix.mibaas.lecture;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.exactsix.mibaas.common.response.RestResponse;
import com.exactsix.mibaas.lecture.dto.EntrollDto;
import com.exactsix.mibaas.lecture.service.LectureManager;

@RequestMapping("/api")
@Controller
public class LectureEntrollController {

	@Autowired
	private LectureManager lectureManager;

	@RequestMapping(value = "/entroll/{lecturecode}", method = RequestMethod.POST)
	public @ResponseBody
	RestResponse createEntrollLecture(@PathVariable String lecturecode,
			@RequestBody EntrollDto entrollDto) {
		entrollDto.setLectureCode(lecturecode);
		return lectureManager.createEntrollLecture(entrollDto);
	}

	@RequestMapping(value = "/entroll/{lecturecode}", method = RequestMethod.DELETE)
	public @ResponseBody
	RestResponse removeEntrollLecture(@PathVariable String lecturecode) {
		EntrollDto entrollDto = new EntrollDto();
		entrollDto.setLectureCode(lecturecode);
		entrollDto.setCustomerCode("dave");
		return lectureManager.removeEntrollLecture(entrollDto);
	}

	@RequestMapping(value = "/entroll/{lecturecode}", method = RequestMethod.PUT)
	public @ResponseBody
	RestResponse updateEntrollLecture(@PathVariable String lecturecode,
			@RequestBody EntrollDto entrollDto) {

		entrollDto.setLectureCode(lecturecode);
		return lectureManager.updateEntrollStatus(entrollDto);
	}
}

@@ -1106,32 +1106,39 @@
 ll/%7Blecturecode%7D
+/cancel
 %22, method = Requ
@@ -1151,14 +1151,12 @@
 hod.
-DELETE
+POST
 )%0A%09p
@@ -1246,26 +1246,24 @@
 code
-) %7B%0A%09%09EntrollDto e
+, @RequestBody E
 ntro
@@ -1272,15 +1272,9 @@
 Dto 
-= new E
+e
 ntro
@@ -1282,11 +1282,11 @@
 lDto
-();
+) %7B
 %0A%09%09e
@@ -1328,46 +1328,8 @@
 e);%0A
-%09%09entrollDto.setCustomerCode(%22dave%22);%0A
 %09%09re

Modify DELTE Method