Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 4, 2019 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/87bea7350386f2ddbeaeb1a83a3728f3 to your computer and use it in GitHub Desktop.
Save parzibyte/87bea7350386f2ddbeaeb1a83a3728f3 to your computer and use it in GitHub Desktop.
@PostMapping(value = "/eliminar")
public String eliminarProducto(@ModelAttribute Producto producto, RedirectAttributes redirectAttrs) {
redirectAttrs
.addFlashAttribute("mensaje", "Eliminado correctamente")
.addFlashAttribute("clase", "warning");
productosRepository.deleteById(producto.getId());
return "redirect:/productos/mostrar";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment