public CodexViewModel Load(UnitOfWork uow, WarframeItemUtilities itemUtils, ClaimsPrincipal user, CodexSection codexSection, int tabID) { CodexSection = codexSection; int?userID = null; if (user.Identity.IsAuthenticated) { userID = int.Parse(user.FindFirstValue(ClaimTypes.NameIdentifier)); } CodexTabs = uow.GetRepo <CodexTabRepository>().GetByCodexSection(codexSection) .OrderBy(x => x.SortingPriority).ThenBy(x => x.Name).ToList(); CurrentCodexTab = CodexTabs.SingleOrDefault(x => x.ID == tabID); new EagerLoader(uow).Load(CodexTabs); WarframeItems = itemUtils .GetByCategoryIDs(CurrentCodexTab.ItemCategory_Objects.Select(x => x.ID)) .OrderBy(x => x.Name).ToList(); if (userID.HasValue) { ItemAcquisitions = uow.GetRepo <ItemAcquisitionRepository>().GetByUserID(userID.Value); } if (CodexSection == CodexSection.Fish) { var fish = uow.GetRepo <FishRepository>().GetAll(); Fish = fish.Where(x => WarframeItems.Select(y => y.UniqueName).Contains(x.UniqueName)).ToDictionary(x => x.UniqueName); } return(this); }
public IActionResult ViewTab(CodexSection id, int tab) { if (id == CodexSection.Mods) { return(View("Mods", new CodexModsViewModel().Load(_uow, _itemUtils, User, tab))); } return(View("View", new CodexViewModel().Load(_uow, _itemUtils, User, id, tab))); }
public IActionResult View(CodexSection id) { if (id == CodexSection.Mods) { return(View("Mods", new CodexModsViewModel().Load(_uow, _itemUtils, User))); } CodexViewModel viewmodel = new CodexViewModel().Load(_uow, _itemUtils, User, id); return(View(viewmodel)); }
public List <ItemCategory> GetByCodexSection(CodexSection relics) { QueryBuilder query = GetQueryBuilder(); query.SqlQuery += " " + "INNER JOIN codextab ct ON " + TableName + ".CodexTabID=ct.ID " + "WHERE ct.CodexSectionID = @CodexSection "; query.AddParameter("@CodexSection", (int)relics); return(GetEntities(query)); }
public List <ItemCache> GetByCodexSection(CodexSection codexSection) { QueryBuilder query = GetQueryBuilder(); query.SqlQuery += "" + "INNER JOIN itemcategory ic ON " + TableName + ".ItemCategoryID = ic.ID " + "INNER JOIN codextab ct ON ic.CodexTabID = ct.ID " + "WHERE ct.CodexSectionID = @CodexSection "; query.AddParameter("@CodexSection", codexSection); return(GetEntities(query)); }
public List <WarframeItem> GetByCodexSection(CodexSection codexSection) { List <ItemCache> caches = new ItemCacheRepository(_unitOfWork).GetByCodexSection(codexSection); if (caches == null && !caches.Any() || caches.First().UpdatedTimestamp < DateTime.Now.AddDays(-2)) { List <ItemCategory> itemCategories = new ItemCategoryRepository(_unitOfWork).GetByCodexSection(codexSection); caches = RedownloadCache().Where(x => itemCategories.Select(y => y.ID).Contains(x.ItemCategoryID)).ToList(); } string test = "[" + string.Join(",", caches.Select(x => x.Data)) + "]"; return(JsonConvert.DeserializeObject <List <WarframeItem> >(test)); }
public List <CodexTab> GetByCodexSection(CodexSection codexSection) { return(GetEntities(WhereEqual(x => x.CodexSectionID, codexSection))); }