public void Run() { List <WarframeItem> allMods = warframeItemUtilities.GetAllMods(); ModSuggestionRepository repo = uow.GetRepo <ModSuggestionRepository>(); List <ModSuggestion> modSuggestions = repo.GetAll(); foreach (ModSuggestion modSuggestion in modSuggestions) { WarframeItem item = allMods.SingleOrDefault(x => x.UniqueName == modSuggestion.UniqueName); if (item != null) { string json = JsonConvert.SerializeObject(item); if (modSuggestion.WarframeItemJson != json) { modSuggestion.WarframeItemJson = json; repo.Update(modSuggestion); } } } }
public IActionResult RefreshModSuggestions() { List <WarframeItem> allMods = itemUtils.GetAllMods(); ModSuggestionRepository repo = uow.GetRepo <ModSuggestionRepository>(); List <ModSuggestion> modSuggestions = repo.GetAll(); foreach (ModSuggestion modSuggestion in modSuggestions) { WarframeItem item = allMods.SingleOrDefault(x => x.UniqueName == modSuggestion.UniqueName); if (item != null) { string json = JsonConvert.SerializeObject(item); if (modSuggestion.WarframeItemJson != json) { modSuggestion.WarframeItemJson = json; repo.Update(modSuggestion); } } } return(Message("Done")); }