private NSArray GetManagedUpdates(string condition = null)
{
var managedUpdates = new List<Models.MunkiManifestManagedUpdate>();
foreach (var templateId in _templateIds)
{
if (!string.IsNullOrEmpty(condition))
managedUpdates.AddRange(
BLL.MunkiManagedUpdate.GetAllManagedUpdatesForMt(templateId)
.Where(x => x.Condition == condition));
else
{
managedUpdates.AddRange(BLL.MunkiManagedUpdate.GetAllManagedUpdatesForMt(templateId)
.Where(x => string.IsNullOrEmpty(x.Condition)));
}
}
var orderedManagedUpdates = managedUpdates.GroupBy(x => x.Name).Select(g => g.First()).OrderBy(x => x.Name);
NSArray plManagedUpdates = new NSArray(orderedManagedUpdates.Count());
var counter = 0;
foreach (var managedUninstall in orderedManagedUpdates)
{
plManagedUpdates.SetValue(counter, managedUninstall.Name);
counter++;
}
return plManagedUpdates;
}