Merge pull request #24 from kipusoep/U4-2421-RemovePropertyGroup

U4-2421 Added RemovePropertyGroup method
This commit is contained in:
Morten Christensen
2013-06-24 01:18:21 -07:00
3 changed files with 23 additions and 0 deletions

View File

@@ -477,6 +477,15 @@ namespace Umbraco.Core.Models
}
}
/// <summary>
/// Removes a PropertyGroup from the current ContentType
/// </summary>
/// <param name="propertyGroupName">Name of the <see cref="PropertyGroup"/> to remove</param>
public void RemovePropertyGroup(string propertyGroupName)
{
PropertyGroups.RemoveItem(propertyGroupName);
}
/// <summary>
/// Sets the ParentId from the lazy integer id
/// </summary>

View File

@@ -64,6 +64,12 @@ namespace Umbraco.Core.Models
/// <param name="propertyTypeAlias">Alias of the <see cref="PropertyType"/> to remove</param>
void RemovePropertyType(string propertyTypeAlias);
/// <summary>
/// Removes a PropertyGroup from the current ContentType
/// </summary>
/// <param name="propertyGroupName">Name of the <see cref="PropertyGroup"/> to remove</param>
void RemovePropertyGroup(string propertyGroupName);
/// <summary>
/// Sets the ParentId from the lazy integer id
/// </summary>

View File

@@ -97,6 +97,14 @@ namespace Umbraco.Core.Models
return this.Any(x => x.Name == groupName);
}
public void RemoveItem(string propertyGroupName)
{
var key = IndexOfKey(propertyGroupName);
//Only removes an item if the key was found
if (key != -1)
RemoveItem(key);
}
public int IndexOfKey(string key)
{
for (var i = 0; i < this.Count; i++)