func (VS *Server) addCategoryToDatabase(c *gin.Context, ca Category, class string, method string, operation string) bool {
	var cat []Category
	VS.DataBase.Find(&cat, bolthold.Where("Name").Eq(ca.Name).And("Type").Eq(ca.Type))
	if len(cat) != 0 {
		if cat[0].ID == ca.ID {
			err := VS.DataBase.Upsert(ca.ID, ca)
			VS.checkOperation(c, class, method, operation, err)
			return true
		}
		return false
	}
	err := VS.DataBase.Upsert(ca.ID, ca)
	VS.checkOperation(c, class, method, operation, err)
	return true
}
// This method adds (or updates) the Category created to the Database, and checks if there is a Category with the same name before saving it
// return true if it can savew it and false otherwise
This method adds (or updates) the Category created to the Database, and checks if there is a Category with the same name before saving it
return true if it can savew it and false otherwise
// This method adds ( or updates ) the Category created to the Database and checks if there is a Category with the same name before saving it // return true if it can savew it and false otherwise
func (VS *Server) addCategoryToDatabase(c *gin.Context, ca Category, class string, method string, operation string) bool {
	var cat []Category
	VS.DataBase.Find(&cat, bolthold.Where("Name").Eq(ca.Name).And("Type").Eq(ca.Type))
	if len(cat) != 0 {
		if cat[0].ID == ca.ID {
			err := VS.DataBase.Upsert(ca.ID, ca)
			VS.checkOperation(c, class, method, operation, err)
			return true
		}
		return false
	}
	err := VS.DataBase.Upsert(ca.ID, ca)
	VS.checkOperation(c, class, method, operation, err)
	return true
}
func ( VS * Server ) addCategoryToDatabase ( c * gin . Context , ca Category , class string , method string , operation string ) bool { var cat [ ] Category VS . DataBase . Find ( & cat , bolthold . Where ( " " ) . Eq ( ca . Name ) . And ( " " ) . Eq ( ca . Type ) ) if len ( cat ) != 0 { if cat [ 0 ] . ID == ca . ID { err := VS . DataBase . Upsert ( ca . ID , ca ) VS . checkOperation ( c , class , method , operation , err ) return true } return false } err := VS . DataBase . Upsert ( ca . ID , ca ) VS . checkOperation ( c , class , method , operation , err ) return true }
This method adds (or updates) the Category created to the Database, and checks if there is a Category with the same name before saving it
return true if it can savew it and false otherwise
This method adds ( or updates ) the Category created to the Database and checks if there is a Category with the same name before saving it return true if it can savew it and false otherwise