func (manage *ManageController) Delete() { // convert the string value to an int articleId, _ := strconv.Atoi(manage.Ctx.Input.Param(":id")) o := orm.NewOrm() o.Using("default") article := models.Article{} // Check if the article exists first if exist := o.QueryTable(article.TableName()).Filter("Id", articleId).Exist(); exist { if num, err := o.Delete(&models.Article{Id: articleId}); err == nil { beego.Info("Record Deleted. ", num) } else { beego.Error("Record couldn't be deleted. Reson: ", err) } } else { beego.Info("Record Doesn't exist.") } }