Subversion Repositories SmartDukaan

Rev

Rev 22191 | Rev 22196 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
22111 ashik.ali 1
package com.spice.profitmandi.web.controller;
2
 
3
import javax.servlet.http.HttpServletRequest;
4
 
5
import org.slf4j.Logger;
6
import org.slf4j.LoggerFactory;
22162 amit.gupta 7
import org.springframework.beans.factory.annotation.Autowired;
22111 ashik.ali 8
import org.springframework.stereotype.Controller;
9
import org.springframework.ui.Model;
10
import org.springframework.web.bind.annotation.PathVariable;
11
import org.springframework.web.bind.annotation.RequestMapping;
12
import org.springframework.web.bind.annotation.RequestMethod;
13
 
22193 amit.gupta 14
import com.spice.profitmandi.dao.model.FofoForm;
22111 ashik.ali 15
import com.spice.profitmandi.dao.repository.dtr.Mongo;
16
 
17
@Controller
18
public class FofoController {
19
 
20
	private static final Logger LOGGER = LoggerFactory.getLogger(FofoController.class);
21
 
22162 amit.gupta 22
 
23
	@Autowired
24
	Mongo mongoClient;
25
 
26
 
22111 ashik.ali 27
	@RequestMapping(value = "/fofo", method = RequestMethod.GET)
28
	public String getAll(HttpServletRequest request, Model model) throws Exception{
22162 amit.gupta 29
		model.addAttribute("fofoForms", mongoClient.getFofoForms(0, 50));
22111 ashik.ali 30
		return "fofo-index";
31
	}
32
 
33
	@RequestMapping(value = "/fofo/{fofoId}/edit", method = RequestMethod.GET)
34
	public String editFofoForm(HttpServletRequest request, @PathVariable(name = "fofoId") int fofoId, Model model) throws Exception{
22193 amit.gupta 35
		FofoForm ff = mongoClient.getFofoForm(fofoId);
36
		model.addAttribute("fofoForm", mongoClient.getFofoFormJsonStringByFofoId(fofoId));
37
		model.addAttribute("email", ff.getRegisteredEmail1());
22191 amit.gupta 38
		return "fofo-form";
22111 ashik.ali 39
	}
40
}