Пример #1
0
func (a *AccountGroupService) Update(accountGroup *models.AccountGroup) error {
	revel.INFO.Println("updating account group", accountGroup.ToString())
	count, err := persistence.Dbm.Update(accountGroup)
	checkErr(err, "account not updated "+accountGroup.ToString())
	if count == 1 {
		return nil
	}
	return err
}
Пример #2
0
func (a *AccountGroupService) Save(accountGroup *models.AccountGroup) *models.AccountGroup {
	revel.INFO.Println("saving account group", accountGroup.ToString())
	// there can only be one default group per account
	_, err := a.FindDefault(accountGroup.AccountId)
	if err != nil {
		accountGroup.Default = false
	} else {
		accountGroup.Default = true
	}
	persistence.Dbm.Insert(accountGroup)
	return accountGroup
}