fixed server side indexer issue

This commit is contained in:
kay.one 2013-05-02 22:24:52 -07:00
commit 1877f70403
15 changed files with 104 additions and 63 deletions

View file

@ -2,17 +2,5 @@
namespace NzbDrone.Api.ClientSchema
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class FieldDefinitionAttribute : Attribute
{
public FieldDefinitionAttribute(int order)
{
Order = order;
}
public int Order { get; private set; }
public string Label { get; set; }
public string HelpText { get; set; }
}
}

View file

@ -1,5 +1,6 @@
using System.Collections.Generic;
using NzbDrone.Common.Reflection;
using NzbDrone.Core.Annotations;
namespace NzbDrone.Api.ClientSchema
{
@ -13,24 +14,28 @@ namespace NzbDrone.Api.ClientSchema
foreach (var propertyInfo in properties)
{
var fieldAttribute = propertyInfo.GetAttribute<FieldDefinitionAttribute>();
var fieldAttribute = propertyInfo.GetAttribute<FieldDefinitionAttribute>(false);
var field = new Field()
{
Name = propertyInfo.Name,
Label = fieldAttribute.Label,
HelpText = fieldAttribute.HelpText,
Order = fieldAttribute.Order,
};
var value = propertyInfo.GetValue(model, null);
if (value != null)
if (fieldAttribute != null)
{
field.Value = value.ToString();
}
result.Add(field);
var field = new Field()
{
Name = propertyInfo.Name,
Label = fieldAttribute.Label,
HelpText = fieldAttribute.HelpText,
Order = fieldAttribute.Order,
};
var value = propertyInfo.GetValue(model, null);
if (value != null)
{
field.Value = value.ToString();
}
result.Add(field);
}
}
return result;