public static List<Group> GetAllGroupsByOwner(User owner)
{
List<Group> ownedGroups = new List<Group>();
using (SqlConnection connection = ConnectionManager.GetConnection())
{
var data = new ActivEarthDataProvidersDataContext(connection);
List<int> groupIds = (from g in data.GroupDataProviders
where g.owner_id == owner.UserID
select g.id
).ToList();
foreach (int groupId in groupIds)
{
Group group = GetGroupFromGroupId(groupId);
ownedGroups.Add(group);
}
return ownedGroups;
}
}