File tree 3 files changed +14
-10
lines changed
3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ func (this *EditController) Get() {
127
127
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
128
128
this.Data["Post"] = models.GetBlog(id)
129
129
this.Layout = "layout.tpl"
130
- this.TplNames = "new .tpl"
130
+ this.TplNames = "edit .tpl"
131
131
}
132
132
133
133
func (this *EditController) Post() {
@@ -150,9 +150,11 @@ type DeleteController struct {
150
150
}
151
151
152
152
func (this *DeleteController) Get() {
153
- id, _ := strconv.Atoi(this.Ctx.Params[":id"])
154
- this.Data["Post"] = models.DelBlog(id)
155
- this.Ctx.Redirect(302, "/")
153
+ id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
154
+ blog := models.GetBlog(id int)
155
+ this.Data["Post"] = blog
156
+ models.DelBlog(blog)
157
+ this.Ctx.Redirect(302, "/")
156
158
}
157
159
```
158
160
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ ViewController:
66
66
}
67
67
68
68
func (this *ViewController) Get() {
69
- id, _ := strconv.Atoi(this.Ctx.Input.Params( ":id") )
69
+ id, _ := strconv.Atoi(this.Ctx.Input.Params[ ":id"] )
70
70
this.Data["Post"] = models.GetBlog(id)
71
71
this.Layout = "layout.tpl"
72
72
this.TplNames = "view.tpl"
@@ -103,7 +103,7 @@ EditController
103
103
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
104
104
this.Data["Post"] = models.GetBlog(id)
105
105
this.Layout = "layout.tpl"
106
- this.TplNames = "new .tpl"
106
+ this.TplNames = "edit .tpl"
107
107
}
108
108
109
109
func (this *EditController) Post() {
@@ -124,8 +124,8 @@ DeleteController
124
124
}
125
125
126
126
func (this *DeleteController) Get() {
127
- id, _ := strconv.Atoi(this.Ctx.Input.Params( ":id") )
128
- blog := GetBlog(id int )
127
+ id, _ := strconv.Atoi(this.Ctx.Input.Params[ ":id"] )
128
+ blog := models. GetBlog(id)
129
129
this.Data["Post"] = blog
130
130
models.DelBlog(blog)
131
131
this.Ctx.Redirect(302, "/")
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ func (this *EditController) Get() {
127
127
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
128
128
this.Data["Post"] = models.GetBlog(id)
129
129
this.Layout = "layout.tpl"
130
- this.TplNames = "new .tpl"
130
+ this.TplNames = "edit .tpl"
131
131
}
132
132
133
133
func (this *EditController) Post() {
@@ -151,7 +151,9 @@ type DeleteController struct {
151
151
152
152
func (this *DeleteController) Get() {
153
153
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
154
- this.Data["Post"] = models.DelBlog(id)
154
+ blog := models.GetBlog(id)
155
+ this.Data["Post"] = blog
156
+ models.DelBlog(blog)
155
157
this.Ctx.Redirect(302, "/")
156
158
}
157
159
```
You can’t perform that action at this time.
0 commit comments