Beispiel #1
0
        public static MvcOptions AddIonOutputFormatter(this MvcOptions options, bool removeJsonOutputFormatter)
        {
            var formatter = options.OutputFormatters.OfType <JsonOutputFormatter>().Single();

            if (removeJsonOutputFormatter)
            {
                options.RemoveJsonOutputFormatter();
                options.OutputFormatters.Add(new IonOutputFormatter(formatter));
            }
            else
            {
                options.OutputFormatters.Insert(0, new IonOutputFormatter(formatter));
            }
            return(options);
        }