func GetSiteDetails(rw http.ResponseWriter, req *http.Request, enc encoding.Encoder, params martini.Params, dtx *apicontext.DataContext) string { var w site.Website var err error idStr := params["id"] id, err := strconv.Atoi(idStr) if err != nil { apierror.GenerateError("Trouble getting site ID", err, rw, req) } w.ID = id err = w.GetDetails(dtx) if err != nil { apierror.GenerateError("Trouble getting site details", err, rw, req) } return encoding.Must(enc.Encode(w)) }
func DeleteSite(rw http.ResponseWriter, req *http.Request, enc encoding.Encoder, params martini.Params) string { var err error var m site.Website idStr := params["id"] id, err := strconv.Atoi(idStr) if err != nil { apierror.GenerateError("Trouble getting website ID", err, rw, req) } m.ID = id err = m.Delete() if err != nil { apierror.GenerateError("Trouble getting website", err, rw, req) } return encoding.Must(enc.Encode(m)) }