func (this *partnerRep) SaveSaleConf(partnerId int, v *partner.SaleConf) error { defer this.renew(v.PartnerId) var err error if v.PartnerId > 0 { _, _, err = this.Connector.GetOrm().Save(v.PartnerId, v) } else { v.PartnerId = partnerId _, _, err = this.Connector.GetOrm().Save(nil, v) } return err }
func (this *configC) SaleConf_post(ctx *web.Context) { partnerId := this.GetPartnerId(ctx) r, w := ctx.Request, ctx.ResponseWriter var result gof.Message r.ParseForm() e := partner.SaleConf{} web.ParseFormToEntity(r.Form, &e) e.PartnerId = partnerId err := dps.PartnerService.SaveSaleConf(partnerId, &e) if err != nil { result = gof.Message{Result: false, Message: err.Error()} } else { result = gof.Message{Result: true, Message: ""} } w.Write(result.Marshal()) }