public Func<IQueryable<Order>, IOrderedQueryable<Order>> GetSortingOrder(ClientDashboardFilter filter, ClientDashboardSortingColumnName defaultColumn, bool defaultIsAsc) { var targetOrder = OrderItems.FirstOrDefault(e => e.ColumnName == filter.ColumnName && e.IsAsc == filter.IsAsc); if (targetOrder != null) { return targetOrder.SortingOrder; } return OrderItems.Single(e => e.ColumnName == defaultColumn && e.IsAsc == defaultIsAsc).SortingOrder; }
private static Func<IQueryable<ActiveOrderItem>, IOrderedQueryable<ActiveOrderItem>> GetActiveOrderSortingDirection(ClientDashboardFilter filter, ClientDashboardSortingColumnName defaultColumn, bool defaultIsAsc) { var targetOrder = ActiveOrderItems.FirstOrDefault(e => e.ColumnName == filter.ColumnName && e.IsAsc == filter.IsAsc); return targetOrder != null ? targetOrder.SortingOrder : ActiveOrderItems.Single(e => e.ColumnName == defaultColumn && e.IsAsc == defaultIsAsc).SortingOrder; }