Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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);
        }