PostulanteController.java 937 Bytes
Newer Older
1 2 3 4 5 6 7 8
package com.roshka.controller;

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;
9
import org.springframework.web.bind.annotation.RequestBody;
10 11 12 13 14 15 16
import org.springframework.web.bind.annotation.RequestMapping;

@Controller

public class PostulanteController {
    @Autowired
    PostulanteRepository post;  
17

18
    @RequestMapping("/")
19 20
    public String index() {
        return "index";
21 22
    }

23 24
    @RequestMapping("/postulante")
    public String getFormPostulante(){
25
        
26 27
        return "postulante-form";
    }
28

29 30
    @PostMapping(value = "/postulante",consumes = "application/json")
    public String guardarPostulante(@RequestBody Postulante postulante){
31
        post.save(postulante);
32
        return "redirect:/";
33 34 35
    }

}