Browse Source

borrarUser ok

master
Juanjo 1 year ago
parent
commit
b2411cbc2b
2 changed files with 6 additions and 7 deletions
  1. +2
    -6
      src/main/java/es/fp/edu/conecta2/controladores/WebControlador.java
  2. +4
    -1
      src/main/java/es/fp/edu/conecta2/servicios/UserService.java

+ 2
- 6
src/main/java/es/fp/edu/conecta2/controladores/WebControlador.java View File

@ -41,20 +41,16 @@ public class WebControlador {
@PostMapping ("/actualizar")
public String actualizaUser(@ModelAttribute("user") User usuario){
servicioUser.actualizaId(usuario);
return "redirect:/";
}
@GetMapping ("/borrar/{num}")
public String borrarUser(Model modelo){
/{num}
public String borrarUser(@PathVariable int num){
servicioUser.deleteId(num);
return "redirect:/";
}
@RequestMapping("parametros/{a}/{b}/{c}")
public String parametros( @PathVariable int a,
@PathVariable int b,


+ 4
- 1
src/main/java/es/fp/edu/conecta2/servicios/UserService.java View File

@ -31,10 +31,13 @@ public class UserService {
public void guardarId(User t) {
int i = repo.actualizaId(t.getIdUsuario(), t.getNombres());
}
public void deleteId(int id) {
repo.deleteById(id);
}
public void actualizaId(User t) {
repo.save(t);
}


Loading…
Cancel
Save