public bool UpdateRole(Role role) { if (role.Id == Guid.Empty) throw new Exception("Invalid role."); if (string.IsNullOrEmpty(role.Name)) throw new Exception("Invalid role name."); return _conn.Perform(conn => conn.Update(role)) == 1; }
public bool InsertRole(Role role) { if (role.Id != Guid.Empty) throw new Exception("A role with a predetermined unique ID can not be created. The Id will be generated automatically."); role.Id = GuidUtil.NewSequentialId(); return _conn.Perform(conn => conn.Insert(role)) == 1; }