Fixing issue in MacroRepository which was causing a test to fail.

Changing the alias of a macro property didn't alias work, so added a fallback to the Id of the property in the cases where the Alias wouldn't work.
This commit is contained in:
Morten Christensen
2014-06-27 12:42:15 +02:00
parent 48143bc0c3
commit 097014454f
2 changed files with 44 additions and 3 deletions

View File

@@ -188,10 +188,22 @@ namespace Umbraco.Core.Persistence.Repositories
}
else
{
//only update if it's dirty
if (macro.Properties[propDto.Alias].IsDirty())
//This will only work if the Alias hasn't been changed
if (macro.Properties.ContainsKey(propDto.Alias))
{
Database.Update(propDto);
//only update if it's dirty
if (macro.Properties[propDto.Alias].IsDirty())
{
Database.Update(propDto);
}
}
else
{
var property = macro.Properties.FirstOrDefault(x => x.Id == propDto.Id);
if (property != null && property.IsDirty())
{
Database.Update(propDto);
}
}
}
}