Skip to content

Instantly share code, notes, and snippets.

@mohashari
Created June 23, 2018 16:50
Show Gist options
  • Select an option

  • Save mohashari/8b7163e8d2b0d45e699e835a9a6bd162 to your computer and use it in GitHub Desktop.

Select an option

Save mohashari/8b7163e8d2b0d45e699e835a9a6bd162 to your computer and use it in GitHub Desktop.
func deleteStudent(c *gin.Context) {
var model student
modelID := c.Param("id")
db.First(&model, modelID)
if model.ID == 0 {
c.JSON(http.StatusNotFound, gin.H{"message": http.StatusNotFound, "result": "Datat Tidak di Temukan"})
}
db.Delete(model)
c.JSON(http.StatusOK, gin.H{"message": http.StatusOK, "result": "Data Telah berhasil di hapus"})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment