PostulanteController.java 1.02 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
package com.roshka.controller;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import com.roshka.modelo.Postulante;
import com.roshka.repositorio.PostulanteRepository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
14
import org.springframework.web.bind.annotation.RequestBody;
15 16 17 18 19 20 21
import org.springframework.web.bind.annotation.RequestMapping;

@Controller

public class PostulanteController {
    @Autowired
    PostulanteRepository post;  
22

23
    @RequestMapping("/")
24 25
    public String index() {
        return "index";
26 27
    }

28 29
    @RequestMapping("/postulante")
    public String getFormPostulante(){
30
        
31 32
        return "postulante-form";
    }
33

34 35
    @PostMapping(value = "/postulante",consumes = "application/json")
    public String guardarPostulante(@RequestBody Postulante postulante){
Nelson Ruiz committed
36
        post.save(postulante);
37
        return "redirect:/";
38 39 40
    }

}