Created
June 23, 2018 16:50
-
-
Save mohashari/8b7163e8d2b0d45e699e835a9a6bd162 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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