// view for delete object func (this *CommentAdminDelete) Post() { if this.FormOnceNotMatch() { return } // delete object if err := models.DeleteById(this.object.Id, this.object); err == nil { this.FlashRedirect("/admin/comment", 302, "DeleteSuccess") return } else { log.Error(err) this.Data["Error"] = err } }
func (this *BulletinAdminDelete) Post() { if this.FormOnceNotMatch() { return } cnt, _ := models.Count(&models.Bulletin{Id: this.object.Id}) if cnt > 0 { // delete object if err := models.DeleteById(this.object.Id, new(models.Bulletin)); err == nil { this.FlashRedirect("/admin/bulletin", 302, "DeleteSuccess") return } else { log.Error(err) this.Data["Error"] = err } } }
// view for delete object func (this *TopicAdminDelete) Post() { if this.FormOnceNotMatch() { return } //check whether there are posts under this topic cnt, _ := models.Count(&models.Post{TopicId: this.object.Id}) if cnt > 0 { this.FlashRedirect("/admin/topic", 302, "DeleteNotAllowed") return } else { // delete object if err := models.DeleteById(this.object.Id, this.object); err == nil { this.FlashRedirect("/admin/topic", 302, "DeleteSuccess") return } else { log.Error(err) this.Data["Error"] = err } } }
// view for delete object func (this *CategoryAdminDelete) Post() { if this.FormOnceNotMatch() { return } // check whether there are topics under the category cnt, _ := models.CountTopicsByCategoryId(this.object.Id) if cnt > 0 { this.FlashRedirect("/admin/category", 302, "DeleteNotAllowed") return } else { // delete object if err := models.DeleteById(this.object.Id, this.object); err == nil { this.FlashRedirect("/admin/category", 302, "DeleteSuccess") return } else { log.Error(err) this.Data["Error"] = err } } }