44f5c208 by astaxie

update example

1 parent 83e26fdc
...@@ -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 {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!