package heroku.template.controller;

import heroku.template.model.Person;
import heroku.template.service.PersonService;

import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class PersonController {

	@Autowired
	private PersonService personService;

	@RequestMapping("/")
	public String listPeople(Map<String, Object> map) {

		map.put("person", new Person());
		map.put("peopleList", personService.listPeople());

		return "people";
	}

	@RequestMapping(value = "/add", method = RequestMethod.POST)
	public String addPerson(@ModelAttribute("person")
	Person person, BindingResult result) {

		personService.addPerson(person);

		return "redirect:/people/";
	}

	@RequestMapping("/delete/{personId}")
	public String deletePerson(@PathVariable("personId")
	Integer personId) {

		personService.removePerson(personId);

		return "redirect:/people/";
	}
}

@@ -28,19 +28,17 @@
 troller;
-%0D%0A%0D
+%0A
 %0Aimport 
@@ -66,17 +66,16 @@
 .Person;
-%0D
 %0Aimport 
@@ -116,38 +116,8 @@
 ice;
-%0D%0A%0D%0Aimport java.util.Map;%0D%0A%0D%0A%0D
 %0Aimp
@@ -175,17 +175,16 @@
 towired;
-%0D
 %0Aimport 
@@ -225,17 +225,16 @@
 troller;
-%0D
 %0Aimport 
@@ -278,17 +278,16 @@
 gResult;
-%0D
 %0Aimport 
@@ -341,17 +341,16 @@
 tribute;
-%0D
 %0Aimport 
@@ -402,17 +402,16 @@
 ariable;
-%0D
 %0Aimport 
@@ -465,17 +465,16 @@
 Mapping;
-%0D
 %0Aimport 
@@ -527,19 +527,40 @@
 tMethod;
-%0D%0A%0D
+%0A%0Aimport java.util.Map;%0A
 %0A@Contro
@@ -563,17 +563,16 @@
 ntroller
-%0D
 %0Apublic 
@@ -595,19 +595,17 @@
 roller %7B
-%0D%0A%0D
+%0A
 %0A%09@Autow
@@ -608,17 +608,16 @@
 utowired
-%0D
 %0A%09privat
@@ -646,19 +646,17 @@
 Service;
-%0D%0A%0D
+%0A
 %0A%09@Reque
@@ -669,17 +669,16 @@
 ing(%22/%22)
-%0D
 %0A%09public
@@ -722,19 +722,17 @@
 %3E map) %7B
-%0D%0A%0D
+%0A
 %0A%09%09map.p
@@ -758,17 +758,16 @@
 rson());
-%0D
 %0A%09%09map.p
@@ -811,19 +811,17 @@
 ople());
-%0D%0A%0D
+%0A
 %0A%09%09retur
@@ -831,23 +831,20 @@
 people%22;
-%0D
 %0A%09%7D
-%0D%0A%0D
+%0A
 %0A%09@Reque
@@ -897,17 +897,16 @@
 od.POST)
-%0D
 %0A%09public
@@ -948,19 +948,17 @@
 person%22)
-%0D%0A%09
+ 
 Person p
@@ -987,19 +987,17 @@
 esult) %7B
-%0D%0A%0D
+%0A
 %0A%09%09perso
@@ -1023,19 +1023,17 @@
 person);
-%0D%0A%0D
+%0A
 %0A%09%09retur
@@ -1058,15 +1058,12 @@
 e/%22;
-%0D
 %0A%09%7D
-%0D%0A%0D
+%0A
 %0A%09@R
@@ -1097,17 +1097,16 @@
 sonId%7D%22)
-%0D
 %0A%09public
@@ -1151,19 +1151,17 @@
 rsonId%22)
-%0D%0A%09
+ 
 Integer 
@@ -1171,19 +1171,17 @@
 sonId) %7B
-%0D%0A%0D
+%0A
 %0A%09%09perso
@@ -1216,11 +1216,9 @@
 Id);
-%0D%0A%0D
+%0A
 %0A%09%09r
@@ -1247,13 +1247,10 @@
 e/%22;
-%0D
 %0A%09%7D
-%0D
 %0A%7D
-%0D
 %0A

Remove line breaks from method signatures