Beispiel #1
0
        public async Task <IActionResult> GetAsync()
        {
            var user = await _dbContext.GetCurrentUserAsync(User);

            if (user == null)
            {
                return(NotFound());
            }

            if (!string.IsNullOrEmpty(user.Wallet) && (string.IsNullOrEmpty(user.WhiteListTransaction) || await _contract.CheckTxStatusAsync(user.WhiteListTransaction)) && !(await _contract.CheckWhitelistAsync(user.Wallet)))
            {
                user.EthAddress = null;
                await _dbContext.SaveChangesAsync();
            }

            return(Ok(new
            {
                Sold = UnitConversion.Convert.FromWei(await _contract.TokenSoldAsync()),
                Cap = UnitConversion.Convert.FromWei(await _contract.GetCapAsync()),
                Ballance = string.IsNullOrEmpty(user.Wallet) ? 0 : UnitConversion.Convert.FromWei(await _contract.GetBallanceAsync(user.Wallet)),
                Refund = string.IsNullOrEmpty(user.Wallet) ? 0 : UnitConversion.Convert.FromWei(await _contract.GetRefundAmountAsync(user.Wallet))
            }));
        }
Beispiel #2
0
        //[HttpGet("locales/{locale}/{file}.json")]
        //public IActionResult GetTranslation([FromRoute]string locale, [FromRoute] string file)
        //{
        //    var path = $"https://raw.githubusercontent.com/cryptoworkplace/translations/master/site/locales/{locale}/{file}.json";

        //    return RedirectPermanent(path);
        //}

        public async Task <IActionResult> Index()
        {
            int sold, cap;

            try
            {
                sold = (int)UnitConversion.Convert.FromWei(await _contract.TokenSoldAsync());
                sold = sold > 0 ? sold : 8031923;
                cap  = (int)UnitConversion.Convert.FromWei(await _contract.GetCapAsync());
                cap  = cap > 0 ? cap : 15000000;
            }
            catch
            {
                sold = 8031923;
                cap  = 15000000;
            }
            var model = new BarModel
            {
                Sold = sold,
                Cap  = cap
            };

            return(View(model));
        }