package com.rms.tfc.web;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.rms.tfc.entity.Producto;
import com.rms.tfc.service.PedidoService;

@Controller
public class NewPedidoController {

	@Resource
	private PedidoService pedidoService;
	
	@RequestMapping("/NewPedido.html")
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		List<Producto> listaProductos = pedidoService.getAllProductos(); 
		return new ModelAndView("newPedido", "objetoJSP", listaProductos);
    }

	public void setPedidoService(PedidoService pedidoService) {
		this.pedidoService = pedidoService;
	}
}