Example #1
0
func (c User) Update(id int64) revel.Result {
	params := c.Params.Form
	userModel := models.GetUserInstance()
	err := userModel.Update(id, params)
	result := result(err)
	return c.RenderJson(result)
}
Example #2
0
func (c User) Create() revel.Result {
	params := c.Params.Form
	userModel := models.GetUserInstance()
	err := userModel.Create(params)
	result := result(err)
	return c.RenderJson(result)
}
Example #3
0
func (c User) Read(id int64) revel.Result {
	userModel := models.GetUserInstance()
	user, err := userModel.Get(id)
	result := result(err)
	if user != nil {
		result["user"] = user
	}
	return c.RenderJson(result)
}
Example #4
0
func (c User) Delete(id int64) revel.Result {
	userModel := models.GetUserInstance()
	err := userModel.Delete(id)
	result := result(err)
	return c.RenderJson(result)
}