Ejemplo n.º 1
0
func UpdateDevice(c *gin.Context) {
	device_name := c.Params.ByName("device_name")
	var payload tf.Device
	c.Bind(&payload)
	var device tf.Device
	device.Device_name = device_name
	if err := device.UpdateDevice(payload); err != nil {
		c.String(http.StatusInternalServerError, fmt.Sprintf("Failed to update device %s.  Error: ", device_name, err))
	} else {
		c.String(http.StatusOK, fmt.Sprintf("Device %s has been updated successfully", device_name))
	}
}