Ejemplo n.º 1
0
        public static IQueryOver <MediaCategory, MediaCategory> OrderBy(
            this IQueryOver <MediaCategory, MediaCategory> query,
            MediaCategorySortMethod sortBy)
        {
            switch (sortBy)
            {
            case MediaCategorySortMethod.CreatedOnDesc:
                return(query.OrderBy(category => category.CreatedOn).Desc);

            case MediaCategorySortMethod.CreatedOn:
                return(query.OrderBy(category => category.CreatedOn).Asc);

            case MediaCategorySortMethod.Name:
                return(query.OrderBy(category => category.Name).Asc);

            case MediaCategorySortMethod.NameDesc:
                return(query.OrderBy(category => category.Name).Desc);

            case MediaCategorySortMethod.DisplayOrderDesc:
                return(query.OrderBy(category => category.DisplayOrder).Desc);

            case MediaCategorySortMethod.DisplayOrder:
                return(query.OrderBy(category => category.DisplayOrder).Asc);

            default:
                throw new ArgumentOutOfRangeException("sortBy");
            }
        }
Ejemplo n.º 2
0
 public static IQueryOver<MediaCategory, MediaCategory> OrderBy(
     this IQueryOver<MediaCategory, MediaCategory> query,
     MediaCategorySortMethod sortBy)
 {
     switch (sortBy)
     {
         case MediaCategorySortMethod.CreatedOnDesc:
             return query.OrderBy(category => category.CreatedOn).Desc;
         case MediaCategorySortMethod.CreatedOn:
             return query.OrderBy(category => category.CreatedOn).Asc;
         case MediaCategorySortMethod.Name:
             return query.OrderBy(category => category.Name).Asc;
         case MediaCategorySortMethod.NameDesc:
             return query.OrderBy(category => category.Name).Desc;
         case MediaCategorySortMethod.DisplayOrderDesc:
             return query.OrderBy(category => category.DisplayOrder).Desc;
         case MediaCategorySortMethod.DisplayOrder:
             return query.OrderBy(category => category.DisplayOrder).Asc;
         default:
             throw new ArgumentOutOfRangeException("sortBy");
     }
 }