Exemplo n.º 1
0
// view for new object save
func (this *TopicAdminRouter) Save() {
	form := post.TopicAdminForm{Create: true}
	if this.ValidFormSets(&form) == false {
		return
	}

	var topic models.Topic
	form.SetToTopic(&topic)
	if err := topic.Insert(); err == nil {
		this.FlashRedirect(fmt.Sprintf("/admin/topic/%d", topic.Id), 302, "CreateSuccess")
		return
	} else {
		beego.Error(err)
		this.Data["Error"] = err
	}
}