Esempio n. 1
0
    public override Task <InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context, Encoding encoding)
    {
        var result = _jsonInputFormatter.ReadRequestBodyAsync(context, encoding);

        foreach (var property in context.ModelType.GetProperties().Where(p => p.PropertyType.IsAssignableFrom(typeof(string)) &&
                                                                         p.CustomAttributes.Any(a => a.AttributeType.IsAssignableFrom(typeof(ToUppercaseAttribute)))))
        {
            var value = (string)property.GetValue(result.Result.Model);
            property.SetValue(result.Result.Model, value.ToUpper());
        }
        return(result);
    }
Esempio n. 2
0
 public override async Task <InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
 {
     return(await _inner.ReadRequestBodyAsync(context).ConfigureAwait(false));
 }