Ejemplo n.º 1
0
func (this *CCVolunteerHandler) DeleteVolunteer(c *gin.Context) {
	fmt.Println("Deleting  volunteer - ")
	filter := util.ExtractVolunteerFilter(c)
	err := dbObj.Remove(filter)
	if err != nil {
		fmt.Println("Unable to remove data - ", err.Error())
	}
}
Ejemplo n.º 2
0
func (this *CCVolunteerHandler) FetchAllVolunteers(c *gin.Context) models.Volunteer_List {
	this.Load()
	fmt.Println("Fetching all the Volunteers - ")
	filter := util.ExtractVolunteerFilter(c)
	results := []models.CCVolunteer{}
	err := dbObj.Find(filter).All(&results)
	if err != nil {
		fmt.Println("Unable to fetch data - ", err.Error())
	}

	fmt.Println("Result  - ", results)

	var volunteer []models.Volunteer
	for i := 0; i < len(results); i++ {
		volModel := this.LoadModel(results[i])
		volunteer = append(volunteer, volModel)
	}

	volunteers := models.Volunteer_List{Volunteers: volunteer}
	return volunteers
}