public static SortingOptions WithField(this SortingOptions options, string field, SortOrder sort = SortOrder.Ascending) { var fieldSort = options.Fields.FirstOrDefault(f => f.Field.Equals(field, StringComparison.OrdinalIgnoreCase)); if (fieldSort == null) { fieldSort = new FieldSort { Field = field, Order = sort }; options.Fields.Add(fieldSort); } fieldSort.Order = sort; return options; }
public static SortingOptions WithField(this SortingOptions options, string field, SortOrder sort = SortOrder.Ascending) { var fieldSort = options.Fields.FirstOrDefault(f => f.Field.Equals(field, StringComparison.OrdinalIgnoreCase)); if (fieldSort == null) { fieldSort = new FieldSort { Field = field, Order = sort }; options.Fields.Add(fieldSort); } fieldSort.Order = sort; return(options); }