Private
Public Access
23 lines
513 B
Go
23 lines
513 B
Go
package grupo
|
|
|
|
import (
|
|
"net/http"
|
|
r "repuestera_back/repositorios"
|
|
"strconv"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func EliminarGrupo(c *gin.Context) {
|
|
id, err := strconv.ParseUint(c.Param("id"), 10, 64)
|
|
if err != nil {
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": "ID invalido"})
|
|
return
|
|
}
|
|
if err := r.ObtenerRepositorios().Grupo.Eliminar(uint(id)); err != nil {
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
|
return
|
|
}
|
|
c.JSON(http.StatusOK, gin.H{"message": "Grupo eliminado"})
|
|
}
|