update example
Showing
1 changed file
with
2 additions
and
2 deletions
| ... | @@ -12,7 +12,7 @@ type ObjectController struct { | ... | @@ -12,7 +12,7 @@ type ObjectController struct { |
| 12 | 12 | ||
| 13 | func (this *ObjectController) Post() { | 13 | func (this *ObjectController) Post() { |
| 14 | var ob models.Object | 14 | var ob models.Object |
| 15 | json.Unmarshal(this.Ctx.RequestBody, &ob) | 15 | json.Unmarshal(this.Ctx.Input.RequestBody, &ob) |
| 16 | objectid := models.AddOne(ob) | 16 | objectid := models.AddOne(ob) |
| 17 | this.Data["json"] = map[string]string{"ObjectId": objectid} | 17 | this.Data["json"] = map[string]string{"ObjectId": objectid} |
| 18 | this.ServeJson() | 18 | this.ServeJson() |
| ... | @@ -37,7 +37,7 @@ func (this *ObjectController) Get() { | ... | @@ -37,7 +37,7 @@ func (this *ObjectController) Get() { |
| 37 | func (this *ObjectController) Put() { | 37 | func (this *ObjectController) Put() { |
| 38 | objectId := this.Ctx.Params[":objectId"] | 38 | objectId := this.Ctx.Params[":objectId"] |
| 39 | var ob models.Object | 39 | var ob models.Object |
| 40 | json.Unmarshal(this.Ctx.RequestBody, &ob) | 40 | json.Unmarshal(this.Ctx.Input.RequestBody, &ob) |
| 41 | 41 | ||
| 42 | err := models.Update(objectId, ob.Score) | 42 | err := models.Update(objectId, ob.Score) |
| 43 | if err != nil { | 43 | if err != nil { | ... | ... |
-
Please register or sign in to post a comment