Exemple #1
0
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, "/")
}
Exemple #2
0
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, "/")
}