Adds the given
Group as a subgroup to this
Group. If the given
Group or this does not exist in the database, then an ArgumentException will be thrown.
Adding subgroups to a GroupAdding subgroups to a Group
using Dynamicweb.eCommerce.Products;
namespace Dynamicweb.Examples.CSharp.eCommerce
{
public class GroupAddSubgroupSample
{
public void CreateNewGroupsAndNestAsSubgroup()
{
// Create a new Group that will be the parent group
var parentGroup = new Group();
parentGroup.Name = "Parent group";
// Create a new Group that will be the subgroup
var subgroup = new Group();
subgroup.Name = "Subgroup";
// Save both groups to the database before creating relations
parentGroup.Save();
subgroup.Save();
// Create nesting relation
parentGroup.AddSubgroup(subgroup);
}
}
}
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2