// Token: 0x06000E3B RID: 3643 RVA: 0x000616C4 File Offset: 0x0005F8C4 public override int Compare(IShopItemGUI a, IShopItemGUI b) { if (a.Item.View.ItemClass == b.Item.View.ItemClass) { InventoryItemGUI inventoryItemGUI = a as InventoryItemGUI; InventoryItemGUI inventoryItemGUI2 = b as InventoryItemGUI; return(ShopSorting.CompareDuration(inventoryItemGUI.InventoryItem, inventoryItemGUI2.InventoryItem, base.Ascending)); } return((!base.Ascending) ? b.Item.View.ItemClass.CompareTo(a.Item.View.ItemClass) : a.Item.View.ItemClass.CompareTo(b.Item.View.ItemClass)); }
// Token: 0x06000E2E RID: 3630 RVA: 0x00061414 File Offset: 0x0005F614 private static int CompareLevel(IUnityItem a, IUnityItem b, bool ascending) { if (a.View.LevelLock < b.View.LevelLock) { return((!ascending) ? 1 : -1); } if (a.View.LevelLock > b.View.LevelLock) { return((!ascending) ? -1 : 1); } return(ShopSorting.CompareName(a, b, ascending)); }
// Token: 0x06000E2D RID: 3629 RVA: 0x0006135C File Offset: 0x0005F55C private static int CompareDuration(InventoryItem a, InventoryItem b, bool ascending) { if (a.IsPermanent && b.IsPermanent) { return(ShopSorting.CompareName(a.Item, b.Item, ascending)); } if (a.IsPermanent) { return((!ascending) ? -1 : 1); } if (b.IsPermanent) { return((!ascending) ? 1 : -1); } if (a.DaysRemaining > b.DaysRemaining) { return((!ascending) ? -1 : 1); } if (a.DaysRemaining < b.DaysRemaining) { return((!ascending) ? 1 : -1); } return(ShopSorting.CompareName(a.Item, b.Item, ascending)); }
// Token: 0x06000E39 RID: 3641 RVA: 0x0000A62C File Offset: 0x0000882C public override int Compare(IShopItemGUI a, IShopItemGUI b) { return(ShopSorting.CompareLevel(a.Item, b.Item, base.Ascending)); }
//========================================================== //========================================================== public ActionResult Index() { ShopFilter filter = new ShopFilter(); // список вкусов List <ShopProductsTaste> tastes = db.ShopProductsTastes.OrderBy(c => c.Name).ToList(); filter.TasteList = new SelectList(tastes, "Id", "Name"); // список брэндов List <ShopProductsBrand> brands = db.ShopProductsBrands.OrderBy(c => c.Name).ToList(); filter.BrandList = new SelectList(brands, "Id", "Name"); // категории List <ShopCategory> parentCategories = db.ShopCategories.Where(p => p.ParentId == null).OrderBy(p => p.Name).ToList(); List <ViewCategoryIndex> hierarchy = new List <ViewCategoryIndex>(); foreach (ShopCategory category in parentCategories) { ViewCategoryIndex categoryToList = new ViewCategoryIndex { Id = category.Id, Name = category.Name, Alias = category.Alias }; hierarchy.Add(categoryToList); hierarchy.AddRange(FindChildCategories(category, "")); } filter.CategoriesList = new SelectList(hierarchy, "Id", "Name"); // сортировка List <ShopSorting> sortingList = new List <ShopSorting>(); ShopSorting sort = new ShopSorting { Id = 1, Name = "Возростание цены" }; sortingList.Add(sort); sort = new ShopSorting { Id = 2, Name = "Убывание цены" }; sortingList.Add(sort); sort = new ShopSorting { Id = 3, Name = "По алфавиту А-Я" }; sortingList.Add(sort); sort = new ShopSorting { Id = 4, Name = "По алфавиту Я-А" }; sortingList.Add(sort); sort = new ShopSorting { Id = 5, Name = "Новые вначале" }; sortingList.Add(sort); sort = new ShopSorting { Id = 6, Name = "Новые в конце" }; sortingList.Add(sort); filter.SortingList = new SelectList(sortingList, "Id", "Name"); return(View(filter)); }