func AddSalesRep(rw http.ResponseWriter, req *http.Request, params martini.Params, enc encoding.Encoder) string { rep := salesrep.SalesRep{ Name: req.FormValue("name"), Code: req.FormValue("code"), } if err := rep.Add(); err != nil { apierror.GenerateError("Trouble adding sales rep", err, rw, req) } return encoding.Must(enc.Encode(rep)) }