func (VS *Server) addVideoCourseToDatabase(c *gin.Context, p VideoCourse, class string, method string, operation string) bool {
	var video []VideoCourse
	VS.DataBase.Find(&video, bolthold.Where("Name").Eq(p.Name))
	if len(video) != 0 {
		if video[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 Product created to the Database,
// we don't allow to have 2 VideoCourse with the same name, so returns true if it can store it
This method adds (or updates) the Product created to the Database,
we don't allow to have 2 VideoCourse with the same name, so returns true if it can store it
// This method adds ( or updates ) the Product created to the Database // we don ' t allow to have 2 VideoCourse with the same name so returns true if it can store it
func (VS *Server) addVideoCourseToDatabase(c *gin.Context, p VideoCourse, class string, method string, operation string) bool {
	var video []VideoCourse
	VS.DataBase.Find(&video, bolthold.Where("Name").Eq(p.Name))
	if len(video) != 0 {
		if video[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 ) addVideoCourseToDatabase ( c * gin . Context , p VideoCourse , class string , method string , operation string ) bool { var video [ ] VideoCourse VS . DataBase . Find ( & video , bolthold . Where ( " " ) . Eq ( p . Name ) ) if len ( video ) != 0 { if video [ 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 Product created to the Database,
we don't allow to have 2 VideoCourse with the same name, so returns true if it can store it
This method adds ( or updates ) the Product created to the Database we don ' t allow to have 2 VideoCourse with the same name so returns true if it can store it