I have a webpage with a table.  The table, with 10 columns, can be sorted by each column ascending or descending.At this moment I control order by big switch:Func<IQueryable<DeviceUsage>, IOrderedQueryable<DeviceUsage>> orderBy;        IOrderedEnumerable<DeviceUsage> info;        switch (sortOrder)        {            case user:                ViewBag.sortableBy = sortOrder;                info = unitOfWork.deviceUsageRepository.Get(where, null, null, d => d.DeviceInstance, d => d.Storage, d => d.User).OrderBy(s => s.User.FullName);                ViewBag.Desc = true;                return PartialView(info.ToPagedList(pageNumber, 15));            case userDesc:                ViewBag.sortableBy = sortOrder;                info = unitOfWork.deviceUsageRepository.Get(where, null, null, d => d.DeviceInstance, d => d.Storage, d => d.User).OrderByDescending(s => s.User.FullName);                ViewBag.Desc = true;                return PartialView(info.ToPagedList(pageNumber, 15));            case manufacturer:                ViewBag.sortableBy = sortOrder;                orderBy = q => q.OrderBy(o => o.DeviceInstance.Device.Manufacturer1.Name);                break;            case manufacturerDesc:                ViewBag.sortableBy = sortOrder;                orderBy = q => q.OrderByDescending(o => o.DeviceInstance.Device.Manufacturer1.Name);                break;            .            .            .            default:                ViewBag.sortableBy=;                orderBy=q => q.OrderBy(o => o.DeviceInstance.Device.CatalogNo);                break;        }This code works but looks not nice.  I think it's the longest switch I ever wrote.Can it be someway upgraded or leave it as it is?Explanation why there is difference in logic:As you can see in user I'm sorting by Fullname which isn't in db ( its created locally in DAL from FirstName & LastName).  @Nick's approach is ok BUT adding a new Desc variable is a bit problematic because there is only the possibility to sort by ONE row at a time. So I would need to store it somewhere in the last sorting order.
Big switch statement for sorting a table
c#