Example #1
0
func CreateBrand(rw http.ResponseWriter, req *http.Request, params martini.Params, enc encoding.Encoder) string {
	br := brand.Brand{
		Name: req.FormValue("name"),
		Code: req.FormValue("code"),
	}

	if err := br.Create(); err != nil {
		apierror.GenerateError("Trouble creating brand", err, rw, req)
	}

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