Ejemplo n.º 1
0
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()
}