package repuestos import ( "net/http" "repuestera_back/models" "github.com/gin-gonic/gin" r "repuestera_back/repositorios" ) func CrearRepuesto(c *gin.Context){ var repuesto *models.Repuesto if err := c.ShouldBindJSON(&repuesto); err != nil { c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) return } if err := r.ObtenerRepositorios().Repuesto.Crear(repuesto); err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } c.JSON(http.StatusCreated, repuesto) }