Private
Public Access
Arreglado bug con la query
This commit is contained in:
1 parent
f9cf001fca
commit
06ed4a518b
3 files changed
+15
-5
No files matched your search
@@ -4,7 +4,6 @@ import (
|
||||
"net/http"
|
||||
dto_builders "repuestera_back/dto/Builders"
|
||||
dto "repuestera_back/dto/Repuestos"
|
||||
"repuestera_back/models"
|
||||
r "repuestera_back/repositorios"
|
||||
"strconv"
|
||||
|
||||
@@ -41,8 +40,13 @@ func ActualizarRepuesto(c *gin.Context){
|
||||
ConMarca(marca.ID).
|
||||
Build()
|
||||
|
||||
entity := &models.Repuesto{ID: id}
|
||||
if err := r.ObtenerRepositorios().Repuesto.Actualizar(&entity, &repuesto); err != nil {
|
||||
entity, err := r.ObtenerRepositorios().Repuesto.ObtenerPorID(uint(id))
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
if err := r.ObtenerRepositorios().Repuesto.Actualizar(entity, &repuesto); err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user