func (this *NewController) Post() { inputs := this.Input() var blog models.Blog blog.Title = inputs.Get("title") blog.Content = inputs.Get("content") blog.Created = time.Now() models.SaveBlog(blog) this.Ctx.Redirect(302, "/") }
func (this *EditController) Post() { inputs := this.Input() var blog models.Blog objectId := this.GetString(":ObjectId") blog.Id = bson.ObjectIdHex(objectId) blog.Title = inputs.Get("title") blog.Content = inputs.Get("content") blog.Created = time.Now() models.SaveBlog(blog) this.Ctx.Redirect(302, "/") }