Example #1
0
// 设置值
func (this *categoryImpl) SetValue(v *content.ArticleCategory) error {
	if this._contentRep.CategoryExists(this._value.Alias, this.GetDomainId()) {
		return content.ErrCategoryAliasExists
	}
	v.Id = this.GetDomainId()
	this._value = v
	return nil
}
Example #2
0
// 保存栏目
func (this *contentRep) SaveCategory(v *content.ArticleCategory) (id int, err error) {
	orm := this.Connector.GetOrm()
	if v.Id > 0 {
		_, _, err = orm.Save(v.Id, v)
	} else {
		var id2 int64
		_, id2, err = orm.Save(nil, v)
		v.Id = int(id2)
	}
	return v.Id, err
}