func (VS *Server) addVillageToDatabase(c *gin.Context, p Village, class string, method string, operation string) bool {
	var villageName []Village
	VS.DataBase.Find(&villageName, bolthold.Where("Name").Eq(p.Name))
	var villagePref []Village
	VS.DataBase.Find(&villagePref, bolthold.Where("Prefix").Eq(p.Prefix))
	if len(villageName)+len(villageName) != 0 {
		// Here we check if we are editing the Village
		if villageName[0].ID == p.ID {
			err := VS.DataBase.Upsert(p.ID, p)
			VS.checkOperation(c, class, method, operation, err)
			return true
		}
		return false
	}
	err := VS.DataBase.Upsert(p.ID, p)
	VS.checkOperation(c, class, method, operation, err)
	return true
}
// This method adds (or updates) the Village created to the Database,
// we don't allow to have 2 Villages with the same name or the same prefix
// Returns true if the operatios was successfully and false if it fails
This method adds (or updates) the Village created to the Database,
we don't allow to have 2 Villages with the same name or the same prefix
Returns true if the operatios was successfully and false if it fails
// This method adds ( or updates ) the Village created to the Database // we don ' t allow to have 2 Villages with the same name or the same prefix // Returns true if the operatios was successfully and false if it fails
func (VS *Server) addVillageToDatabase(c *gin.Context, p Village, class string, method string, operation string) bool {
	var villageName []Village
	VS.DataBase.Find(&villageName, bolthold.Where("Name").Eq(p.Name))
	var villagePref []Village
	VS.DataBase.Find(&villagePref, bolthold.Where("Prefix").Eq(p.Prefix))
	if len(villageName)+len(villageName) != 0 {
		if villageName[0].ID == p.ID {
			err := VS.DataBase.Upsert(p.ID, p)
			VS.checkOperation(c, class, method, operation, err)
			return true
		}
		return false
	}
	err := VS.DataBase.Upsert(p.ID, p)
	VS.checkOperation(c, class, method, operation, err)
	return true
}
func ( VS * Server ) addVillageToDatabase ( c * gin . Context , p Village , class string , method string , operation string ) bool { var villageName [ ] Village VS . DataBase . Find ( & villageName , bolthold . Where ( " " ) . Eq ( p . Name ) ) var villagePref [ ] Village VS . DataBase . Find ( & villagePref , bolthold . Where ( " " ) . Eq ( p . Prefix ) ) if len ( villageName ) + len ( villageName ) != 0 { if villageName [ 0 ] . ID == p . ID { err := VS . DataBase . Upsert ( p . ID , p ) VS . checkOperation ( c , class , method , operation , err ) return true } return false } err := VS . DataBase . Upsert ( p . ID , p ) VS . checkOperation ( c , class , method , operation , err ) return true }
This method adds (or updates) the Village created to the Database,
we don't allow to have 2 Villages with the same name or the same prefix
Returns true if the operatios was successfully and false if it fails
This method adds ( or updates ) the Village created to the Database we don ' t allow to have 2 Villages with the same name or the same prefix Returns true if the operatios was successfully and false if it fails
// Here we check if we are editing the Village