Example #1
0
        public void MultipleOrderDataSet(TableFilterModel tableFilterPayload)
        {
            tableFilterPayload.MultiSortMeta.Select((value, i) => new { i, value }).ToList().ForEach(o =>
            {
                switch (o.value.Order)
                {
                case (int)SortingEnumeration.OrderByAsc:
                    if (o.i == 0)
                    {
                        _linqOperator.OrderBy(o.value.Field.FirstCharToUpper());
                    }
                    else
                    {
                        _linqOperator.ThenBy(o.value.Field.FirstCharToUpper());
                    }
                    break;

                case (int)SortingEnumeration.OrderByDesc:
                    if (o.i == 0)
                    {
                        _linqOperator.OrderByDescending(o.value.Field.FirstCharToUpper());
                    }
                    else
                    {
                        _linqOperator.ThenByDescending(o.value.Field.FirstCharToUpper());
                    }
                    break;

                default:
                    throw new System.ArgumentException("Invalid Sort Order!");
                }
            });
        }