Example #1
0
func (this *PageController) Delete() {
	id := this.Ctx.Input.Param(":id")
	page := new(models.Page)
	ajaxResult := page.Delete(id)
	this.Data["json"] = ajaxResult
	this.ServeJson()
}
Example #2
0
func (this *HomeController) PageDetail() {
	id := this.Ctx.Input.Param(":id")
	page := new(models.Page)
	err := page.GetPageInfo(id)
	if err != nil {
		fmt.Println(err)
	}
	this.Data["page"] = page
	this.TplNames = "front/pagedetail.tpl"
}
Example #3
0
func (this *PageController) GetData() {
	id := this.Ctx.Input.Param(":id")
	page := new(models.Page)
	err := page.GetPageInfo(id)
	if err != nil {
		fmt.Println(err)
	}

	this.Data["json"] = page
	this.ServeJson()
}
Example #4
0
func (this *PageController) Save() {
	ajaxResult := new(models.AjaxResult)
	page := new(models.Page)
	err := json.Unmarshal(this.Ctx.Input.RequestBody, &page)
	if err != nil {
		ajaxResult.Error = err.Error()
	} else {
		err = page.Save()
		if err != nil {
			ajaxResult.Error = err.Error()
		} else {
			ajaxResult.Success = true
			ajaxResult.Msg = &page
		}
	}

	this.Data["json"] = ajaxResult
	this.ServeJson()
}
Example #5
0
func (this *PageController) GetDataList() {
	page := new(models.Page)
	list := page.GetList()
	this.Data["json"] = list
	this.ServeJson()
}