1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 12:50:55 +00:00

update example

This commit is contained in:
astaxie 2013-09-10 15:08:32 +08:00
parent 83e26fdc9b
commit 44f5c208b6

View File

@ -12,7 +12,7 @@ type ObjectController struct {
func (this *ObjectController) Post() { func (this *ObjectController) Post() {
var ob models.Object var ob models.Object
json.Unmarshal(this.Ctx.RequestBody, &ob) json.Unmarshal(this.Ctx.Input.RequestBody, &ob)
objectid := models.AddOne(ob) objectid := models.AddOne(ob)
this.Data["json"] = map[string]string{"ObjectId": objectid} this.Data["json"] = map[string]string{"ObjectId": objectid}
this.ServeJson() this.ServeJson()
@ -37,7 +37,7 @@ func (this *ObjectController) Get() {
func (this *ObjectController) Put() { func (this *ObjectController) Put() {
objectId := this.Ctx.Params[":objectId"] objectId := this.Ctx.Params[":objectId"]
var ob models.Object var ob models.Object
json.Unmarshal(this.Ctx.RequestBody, &ob) json.Unmarshal(this.Ctx.Input.RequestBody, &ob)
err := models.Update(objectId, ob.Score) err := models.Update(objectId, ob.Score)
if err != nil { if err != nil {