示例#1
0
文件: topics.go 项目: ninnemana/API
func DeleteTopic(rw http.ResponseWriter, req *http.Request, params martini.Params, enc encoding.Encoder, dtx *apicontext.DataContext) string {
	var err error
	var topic forum.Topic

	if topic.ID, err = strconv.Atoi(params["id"]); err != nil {
		apierror.GenerateError("Trouble getting forum topic ID", err, rw, req)
	}

	if err = topic.Delete(dtx); err != nil {
		apierror.GenerateError("Trouble deleting forum topic", err, rw, req)
	}

	return encoding.Must(enc.Encode(topic))
}