func GetPriceByCustomer(rw http.ResponseWriter, r *http.Request, enc encoding.Encoder, params martini.Params) string { var err error var ps customer.CustomerPrices var c customer.Customer id := r.FormValue("id") if id == "" { id = params["id"] } if c.Id, err = strconv.Atoi(id); err != nil { apierror.GenerateError("Trouble getting customer ID", err, rw, r) return "" } if ps, err = c.GetPricesByCustomer(); err != nil { apierror.GenerateError("Trouble getting prices by customer ID", err, rw, r) return "" } return encoding.Must(enc.Encode(ps)) }