Пример #1
0
        private object RouteTokensNft(HTTPRequest request)
        {
            var address = request.GetVariable("input");

            try
            {
                var nftList = TokensControllerInstance.GetNftListByAddress(address);
                var context = GetSessionContext(request);
                if (nftList != null && nftList.Any())
                {
                    context[AppSettings.MenuContext]      = _menus;
                    context[AppSettings.NftTokensContext] = nftList;
                    return(RendererView(context, "layout", AppSettings.NftTokensContext));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            _errorContextInstance.ErrorCode        = "nft error";
            _errorContextInstance.ErrorDescription = $"no nfts found for this {address} address";
            request.session.SetStruct <ErrorContext>(AppSettings.ErrorContext, _errorContextInstance);

            return(HTTPResponse.Redirect(AppSettings.UrlError));
        }
Пример #2
0
        private object RouteTokens(HTTPRequest request)
        {
            try
            {
                var tokensList = TokensControllerInstance.GetTokens();
                var temp       = tokensList.SingleOrDefault(t => t.Name == "Trophy");
                var context    = GetSessionContext(request);
                tokensList.Remove(temp);
                if (tokensList.Any())
                {
                    ActivateMenuItem(AppSettings.UrlTokens);

                    context[AppSettings.MenuContext]   = _menus;
                    context[AppSettings.TokensContext] = tokensList;
                    return(RendererView(context, "layout", AppSettings.TokensContext));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            _errorContextInstance.ErrorCode        = "token error";
            _errorContextInstance.ErrorDescription = "Tokens not found";
            request.session.SetStruct <ErrorContext>(AppSettings.ErrorContext, _errorContextInstance);

            return(HTTPResponse.Redirect(AppSettings.UrlError));
        }