public List <AppViewModel> GetAllApps() { var appQuery = new AppQueries(_context); var txQuery = new TransactionQueries(_context); List <AppViewModel> appsList = new List <AppViewModel>(); var apps = appQuery.QueryApps(); foreach (var appInfo in apps) { var txCount = txQuery.QueryTotalChainTransactionCount(appInfo.Id); var vm = AppViewModel.FromApp(appInfo); vm.TxCount = txCount; appsList.Add(vm); } appsList = appsList.OrderByDescending(x => x.TxCount).ToList(); for (int i = 0; i < appsList.Count; i++) { appsList[i].Rank = i + 1; } return(appsList); }
public AppViewModel GetApp(string appId) { var appQuery = new AppQueries(_context); var app = appQuery.QueryApp(appId); return(AppViewModel.FromApp(app)); }
public string SearchCommand(string input) { try { if (Address.IsValidAddress(input)) //maybe is address { return($"address/{input}"); } //token var token = new TokenQueries(_context).QueryToken(input.ToUpperInvariant()); if (token != null)// token { return($"token/{token.Symbol}"); } //app var app = new AppQueries(_context).QueryApp(input); if (app != null) { return($"app/{app.Id}"); } //chain var chain = new ChainQueries(_context).QueryChain(input); if (chain != null) { return($"chain/{chain.Address}"); } //hash if (Hash.TryParse(input, out var hash)) { var tx = new TransactionQueries(_context).QueryTransaction(input); if (tx != null) { return($"tx/{tx.Hash}"); } var block = new BlockQueries(_context).QueryBlock(input); if (block != null) { return($"block/{block.Hash}"); } } return(null); } catch (Exception e) { Console.WriteLine(e); return("/home"); } }
public IActionResult QueryWithParams([FromServices] AppQueries queries, string queryName) { return(GetResponse(queries, queryName)); }