func (VS *Server) addUserToDatabase(c *gin.Context, u User, class string, method string, operation string) bool {
	// We check if the username is available, if not send error mesage and break
	var users []User
	if err := VS.DataBase.Find(&users, bolthold.Where("Username").Eq(u.Username)); err != nil {
		return false
	}
	if len(users) > 0 {
		if users[0].ID != u.ID {
			VS.wrongFeedback(c, "The Username is already taken")
			return false
		}
	}
	err := VS.DataBase.Upsert(u.ID, u)
	VS.checkOperation(c, class, method, operation, err)
	return true
}
// This method adds (or updates) the User created to the Database
// Returns true if the operatios was sucessfully and false if it fails
This method adds (or updates) the User created to the Database
Returns true if the operatios was sucessfully and false if it fails
// This method adds ( or updates ) the User created to the Database // Returns true if the operatios was sucessfully and false if it fails
func (VS *Server) addUserToDatabase(c *gin.Context, u User, class string, method string, operation string) bool {
	var users []User
	if err := VS.DataBase.Find(&users, bolthold.Where("Username").Eq(u.Username)); err != nil {
		return false
	}
	if len(users) > 0 {
		if users[0].ID != u.ID {
			VS.wrongFeedback(c, "The Username is already taken")
			return false
		}
	}
	err := VS.DataBase.Upsert(u.ID, u)
	VS.checkOperation(c, class, method, operation, err)
	return true
}
func ( VS * Server ) addUserToDatabase ( c * gin . Context , u User , class string , method string , operation string ) bool { var users [ ] User if err := VS . DataBase . Find ( & users , bolthold . Where ( " " ) . Eq ( u . Username ) ) ; err != nil { return false } if len ( users ) > 0 { if users [ 0 ] . ID != u . ID { VS . wrongFeedback ( c , " " ) return false } } err := VS . DataBase . Upsert ( u . ID , u ) VS . checkOperation ( c , class , method , operation , err ) return true }
This method adds (or updates) the User created to the Database
Returns true if the operatios was sucessfully and false if it fails
This method adds ( or updates ) the User created to the Database Returns true if the operatios was sucessfully and false if it fails
// We check if the username is available, if not send error mesage and break