func (VS *Server) editService(c *gin.Context) {
	//Get the id of the Product from the Link
	id, b := VS.getIDParamFromURL(c, "id")
	if !b {
		return
	}
	oldService := VS.getServiceByID(c, id, "h_data", "editService", "oldService := VS.getServiceByID", true)
	newService, b := VS.getNewService(c, id)
	if !b {
		return
	}
	fmt.Print("This is service complete: ")
	fmt.Println(newService)

	// Audit
	audit := VS.getAuditFromCentral(c, newService, id, Modified)
	modified := VS.dynamicAuditChange(c, newService, oldService, audit.ID)
	oldVillage := VS.getVillageByID(c, oldService.IDVillage, "h_data", "editService", "oldVillage := VS.getVillageByID").Name
	newVillage := VS.getVillageByID(c, newService.IDVillage, "h_data", "editService", "newVillage := VS.getVillageByID").Name
	if VS.checkChange(c, audit.ID, "VillageID", oldVillage, newVillage) {
		VS.deleteAllAccessByService(c, id, "h_data", "editService", "VS.deleteAllAccessByService")
		modified = true
	}
	if modified {
		if VS.addServiceToDatabase(c, newService, "h_data", "editService", "VS.addServiceToDatabase") {
			VS.registerAuditAndEvent(c, audit, newService, newService.ID)
		} else {
			VS.wrongFeedback(c, "Sorry, there is already one Service with that name in that Village. Please choose another name ")
		}
	}
	VS.goodFeedback(c, "/data/villages")
}
// Modified the Service into the Database
Modified the Service into the Database
// Modified the Service into the Database
func (VS *Server) editService(c *gin.Context) {
	id, b := VS.getIDParamFromURL(c, "id")
	if !b {
		return
	}
	oldService := VS.getServiceByID(c, id, "h_data", "editService", "oldService := VS.getServiceByID", true)
	newService, b := VS.getNewService(c, id)
	if !b {
		return
	}
	fmt.Print("This is service complete: ")
	fmt.Println(newService)
	audit := VS.getAuditFromCentral(c, newService, id, Modified)
	modified := VS.dynamicAuditChange(c, newService, oldService, audit.ID)
	oldVillage := VS.getVillageByID(c, oldService.IDVillage, "h_data", "editService", "oldVillage := VS.getVillageByID").Name
	newVillage := VS.getVillageByID(c, newService.IDVillage, "h_data", "editService", "newVillage := VS.getVillageByID").Name
	if VS.checkChange(c, audit.ID, "VillageID", oldVillage, newVillage) {
		VS.deleteAllAccessByService(c, id, "h_data", "editService", "VS.deleteAllAccessByService")
		modified = true
	}
	if modified {
		if VS.addServiceToDatabase(c, newService, "h_data", "editService", "VS.addServiceToDatabase") {
			VS.registerAuditAndEvent(c, audit, newService, newService.ID)
		} else {
			VS.wrongFeedback(c, "Sorry, there is already one Service with that name in that Village. Please choose another name ")
		}
	}
	VS.goodFeedback(c, "/data/villages")
}
func ( VS * Server ) editService ( c * gin . Context ) { id , b := VS . getIDParamFromURL ( c , " " ) if ! b { return } oldService := VS . getServiceByID ( c , id , " " , " " , " " , true ) newService , b := VS . getNewService ( c , id ) if ! b { return } fmt . Print ( " " ) fmt . Println ( newService ) audit := VS . getAuditFromCentral ( c , newService , id , Modified ) modified := VS . dynamicAuditChange ( c , newService , oldService , audit . ID ) oldVillage := VS . getVillageByID ( c , oldService . IDVillage , " " , " " , " " ) . Name newVillage := VS . getVillageByID ( c , newService . IDVillage , " " , " " , " " ) . Name if VS . checkChange ( c , audit . ID , " " , oldVillage , newVillage ) { VS . deleteAllAccessByService ( c , id , " " , " " , " " ) modified = true } if modified { if VS . addServiceToDatabase ( c , newService , " " , " " , " " ) { VS . registerAuditAndEvent ( c , audit , newService , newService . ID ) } else { VS . wrongFeedback ( c , " " ) } } VS . goodFeedback ( c , " " ) }
Modified the Service into the Database
Modified the Service into the Database
//Get the id of the Product from the Link // Audit