func (this *ClubController) Clubs() { time, _ := strconv.Atoi(this.Ctx.Input.Param(":time")) c := models.Club{} clubs := c.GetByTime(time) response := Response{clubs} b, _ := json.Marshal(&response) this.Data["json"] = string(b) this.ServeJson() }
func (this *ClubController) UpdateClub() { password := this.GetString("password") if password != "ronak123" { this.Data["json"] = failjson this.ServeJson() return } title := this.GetString("title") description := this.GetString("description") president := this.GetString("president") contact := this.GetString("contact") club := models.Club{} club.President = president club.Contact = contact club.Title = title club.Description = description club.Lastmod = int(time.Now().Unix()) err := club.UpdateByTitle() if err != true { this.Data["json"] = failjson this.ServeJson() return } else { this.Data["json"] = passjson this.ServeJson() return } }