public async Task Reload() { var ivLists = await _ivListRepository.GetAllAsync().ConfigureAwait(false); lock (_ivListsLock) { _ivLists.Clear(); foreach (var ivList in ivLists) { if (!_ivLists.ContainsKey(ivList.Name)) { _ivLists.Add(ivList.Name, ivList); } } } }
public async Task <dynamic> GetIVLists() { var ivLists = await _ivListRepository.GetAllAsync().ConfigureAwait(false); var list = new List <dynamic>(); foreach (var ivList in ivLists) { list.Add(new { name = ivList.Name, pokemon_list_count = ivList.PokemonIDs.Count.ToString("N0"), buttons = $"<a href='/dashboard/ivlist/edit/{Uri.EscapeDataString(ivList.Name)}' role='button' class='btn btn-sm btn-primary'>Edit</a>", }); } return(new { data = new { ivlists = list } }); }