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() }
func (this *ArtilcecategoryController) Save() { ajaxResult := new(models.AjaxResult) category := new(models.Articlecategory) err := json.Unmarshal(this.Ctx.Input.RequestBody, &category) if err != nil { ajaxResult.Error = err.Error() } else { err = category.Save() if err != nil { ajaxResult.Error = err.Error() } else { ajaxResult.Success = true ajaxResult.Msg = &category } } this.Data["json"] = ajaxResult this.ServeJson() }