Subversion Repositories SmartDukaan

Rev

Rev 22191 | Rev 22196 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.web.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.spice.profitmandi.dao.model.FofoForm;
import com.spice.profitmandi.dao.repository.dtr.Mongo;

@Controller
public class FofoController {
        
        private static final Logger LOGGER = LoggerFactory.getLogger(FofoController.class);
        

        @Autowired
        Mongo mongoClient;
        
        
        @RequestMapping(value = "/fofo", method = RequestMethod.GET)
        public String getAll(HttpServletRequest request, Model model) throws Exception{
                model.addAttribute("fofoForms", mongoClient.getFofoForms(0, 50));
                return "fofo-index";
        }
        
        @RequestMapping(value = "/fofo/{fofoId}/edit", method = RequestMethod.GET)
        public String editFofoForm(HttpServletRequest request, @PathVariable(name = "fofoId") int fofoId, Model model) throws Exception{
                FofoForm ff = mongoClient.getFofoForm(fofoId);
                model.addAttribute("fofoForm", mongoClient.getFofoFormJsonStringByFofoId(fofoId));
                model.addAttribute("email", ff.getRegisteredEmail1());
                return "fofo-form";
        }
}