Beispiel #1
0
        public ActionResult OrderHistory()
        {
            //var id = User.Identity.GetUserId();
            ////IEnumerable<AllHistory> students = null;

            //using (var client = new HttpClient())
            //{
            //    client.BaseAddress = new Uri("http://localhost:57986/api/Transaction/Getid");
            //    //HTTP GET
            //    var responseTask = client.GetAsync("http://localhost:57986/api/Transaction/Getid?id=" + id);
            //    responseTask.Wait();

            //    var result = responseTask.Result;
            //    if (result.IsSuccessStatusCode)
            //    {
            //        var readTask = result.Content.ReadAsAsync<IList<AllHistory>>();
            //        readTask.Wait();

            //        ViewBag.AllResult = readTask.Result;

            //    }
            //    else //web api sent error response
            //    {
            //        //log response status here..
            //        ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
            //    }
            //}
            var d = CoinsMarketValueController.GetMarkupWithCoinId();

            foreach (var r in d)
            {
                switch (r.Key)
                {
                case 101: mark101 = r.Value; break;

                case 102: mark102 = r.Value; break;

                case 103: mark103 = r.Value; break;

                case 104: mark104 = r.Value; break;

                case 105: mark105 = r.Value; break;

                case 106: mark106 = r.Value; break;
                }
            }

            try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
            try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
            try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
            try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
            try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
            try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }
            GetSend();
            GetReceive();
            GetBuy();
            GetSell();
            GetExchange();
            return(View());
        }
Beispiel #2
0
        public ActionResult WalletBalance()
        {
            decimal?mark101 = 0;
            decimal?mark102 = 0;
            decimal?mark103 = 0;
            decimal?mark104 = 0;
            decimal?mark105 = 0;
            decimal?mark106 = 0;
            //decimal? markup = 0;
            var d = CoinsMarketValueController.GetMarkupWithCoinId();

            foreach (var r in d)
            {
                switch (r.Key)
                {
                case 101: mark101 = r.Value; break;

                case 102: mark102 = r.Value; break;

                case 103: mark103 = r.Value; break;

                case 104: mark104 = r.Value; break;

                case 105: mark105 = r.Value; break;

                case 106: mark106 = r.Value; break;
                }
            }

            APIcontroller.CoinsMarketValueController objCoin = new APIcontroller.CoinsMarketValueController();

            try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
            try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
            try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
            try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
            try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
            try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }

            BlockChainEntities db     = new BlockChainEntities();
            string             userId = User.Identity.GetUserId();
            var walletbalance         = db.GetWalletBalance(userId);

            ViewBag.walletbalance = walletbalance;
            return(View());
        }
        public ActionResult Settings()
        {
            var d = CoinsMarketValueController.GetMarkupWithCoinId();

            foreach (var r in d)
            {
                switch (r.Key)
                {
                case 101: mark101 = r.Value; break;

                case 102: mark102 = r.Value; break;

                case 103: mark103 = r.Value; break;

                case 104: mark104 = r.Value; break;

                case 105: mark105 = r.Value; break;

                case 106: mark106 = r.Value; break;
                }
            }

            try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
            try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
            try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
            try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
            try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
            try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }

            //SettingViewMode s = new SettingViewMode();
            // var Profile = ValueController.GetCutomerProfile(User.Identity.GetUserId());
            // s.profile = Profile;
            GetCustomerProfile(User.Identity.GetUserId());
            var res = GetCountry();

            Session["Country"] = res;
            ViewBag.Country    = res;
            if (s.profile == null)
            {
                ViewBag.ProfileData = 0;
            }
            return(View("Settings", s));
        }
Beispiel #4
0
        public ActionResult SellBitcoin()
        {
            //SellViewModel obj = new SellViewModel();
            //ValueController ob1 = new ValueController();
            //obj.CoinList = ob1.GetCoin().ToList();
            //Session["a"] = obj.CoinList;
            //return View(obj);

            //decimal? markup = 0;
            var d = CoinsMarketValueController.GetMarkupWithCoinId();

            foreach (var r in d)
            {
                switch (r.Key)
                {
                case 101: mark101 = r.Value; break;

                case 102: mark102 = r.Value; break;

                case 103: mark103 = r.Value; break;

                case 104: mark104 = r.Value; break;

                case 105: mark105 = r.Value; break;

                case 106: mark106 = r.Value; break;
                }
            }

            try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
            try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
            try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
            try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
            try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
            try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }

            Notification    ob1      = new Notification();
            List <CoinList> coinlist = ob1.GetCoin();

            Session["a"]     = coinlist;
            ViewBag.Coinlist = coinlist;
            return(View());
        }
Beispiel #5
0
        public async System.Threading.Tasks.Task <ActionResult> Security()
        {
            var d = CoinsMarketValueController.GetMarkupWithCoinId();

            foreach (var r in d)
            {
                switch (r.Key)
                {
                case 101: mark101 = r.Value; break;

                case 102: mark102 = r.Value; break;

                case 103: mark103 = r.Value; break;

                case 104: mark104 = r.Value; break;

                case 105: mark105 = r.Value; break;

                case 106: mark106 = r.Value; break;
                }
            }

            try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
            try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
            try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
            try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
            try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
            try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }
            GetQR();

            sample s = new sample {
                TwoFactor = await UserManager.GetTwoFactorEnabledAsync(User.Identity.GetUserId()), GoogleStatus = obj.GetGoogleStatus(User.Identity.GetUserId())
            };
            var sm = ValueController.GetSession(User.Identity.GetUserId());

            ViewBag.IpWhiteList = sm.IPAdressWhiteList;
            SVM.s = s; SVM.Sm = sm;

            Session["EmailStatus"] = s;
            return(View(SVM));
        }
Beispiel #6
0
        public ActionResult BuyBitcoin(BuyViewModel obj)
        {
            if (!ModelState.IsValid)
            {
                var d1 = CoinsMarketValueController.GetMarkupWithCoinId();
                foreach (var r in d1)
                {
                    switch (r.Key)
                    {
                    case 101: mark101 = r.Value; break;

                    case 102: mark102 = r.Value; break;

                    case 103: mark103 = r.Value; break;

                    case 104: mark104 = r.Value; break;

                    case 105: mark105 = r.Value; break;

                    case 106: mark106 = r.Value; break;
                    }
                }

                try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
                try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
                try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
                try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
                try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
                try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }

                ViewBag.Coinlist = Session["a"];
                return(View(obj));
            }

            var userId = User.Identity.GetUserId();

            obj.UserId = userId;
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(url + "Transaction/Buy");

                //HTTP POST
                var postTask = client.PostAsJsonAsync(url + "Transaction/Buy", obj);
                postTask.Wait();

                var result = postTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    //return RedirectToAction("Index");
                    EmailNotification en = Session["Notification"] as EmailNotification;
                    if (en.Buy == true)
                    {
                        string uname = Session["UserName"] as string;
                        string Email = Session["Email"] as string;
                        string res   = "Hi," + uname + " you sent buy coin requist. ";
                        // SendMail a = new Blockchaninaccounts.App_Start.SendMail();
                        SendMail.Mail(Email, res);
                    }
                    ViewBag.msg = "Buy Amount Saved Successfully";

                    var d2 = CoinsMarketValueController.GetMarkupWithCoinId();
                    foreach (var r in d2)
                    {
                        switch (r.Key)
                        {
                        case 101: mark101 = r.Value; break;

                        case 102: mark102 = r.Value; break;

                        case 103: mark103 = r.Value; break;

                        case 104: mark104 = r.Value; break;

                        case 105: mark105 = r.Value; break;

                        case 106: mark106 = r.Value; break;
                        }
                    }

                    try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
                    try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
                    try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
                    try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
                    try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
                    try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }
                    ModelState.Clear();
                    return(View("DashboardSuccess"));
                }
                //else
                //{
                //    ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator.");
                //}
            }

            ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator.");
            //ModelState.Clear();
            ViewBag.Coinlist = Session["a"];

            var d = CoinsMarketValueController.GetMarkupWithCoinId();

            foreach (var r in d)
            {
                switch (r.Key)
                {
                case 101: mark101 = r.Value; break;

                case 102: mark102 = r.Value; break;

                case 103: mark103 = r.Value; break;

                case 104: mark104 = r.Value; break;

                case 105: mark105 = r.Value; break;

                case 106: mark106 = r.Value; break;
                }
            }

            try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
            try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
            try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
            try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
            try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
            try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }
            return(View(obj));
        }
Beispiel #7
0
        public ActionResult Index()
        {
            decimal?mark101 = 0;
            decimal?mark102 = 0;
            decimal?mark103 = 0;
            decimal?mark104 = 0;
            decimal?mark105 = 0;
            decimal?mark106 = 0;
            //decimal? markup = 0;
            var d = CoinsMarketValueController.GetMarkupWithCoinId();

            foreach (var r in d)
            {
                switch (r.Key)
                {
                case 101: mark101 = r.Value; break;

                case 102: mark102 = r.Value; break;

                case 103: mark103 = r.Value; break;

                case 104: mark104 = r.Value; break;

                case 105: mark105 = r.Value; break;

                case 106: mark106 = r.Value; break;
                }
            }

            var userId      = User.Identity.GetUserId();
            var transaction = db.GetRecentTransactionList(userId);

            ViewBag.userid = userId;
            var activity      = db.GetActivityLogList(userId);
            var walletbalance = db.GetWalletBalance(userId);
            var coinlist      = db.GetCoinsList();

            ViewBag.totaltransaction = db.GetTotalTransaction(userId).DefaultIfEmpty(0).FirstOrDefault();  //.SingleOrDefault();
            decimal Totalbalance     = 0;
            decimal availablebalance = 0;

            foreach (GetWalletBalance_Result result in walletbalance)
            {
                if (result.CoinName == "MicroBitcoin")
                {
                    Totalbalance     = Totalbalance + Convert.ToDecimal(result.TotalBalance);
                    availablebalance = availablebalance + Convert.ToDecimal(result.AvailableBalance);
                }
            }
            ViewBag.Totalbalance     = Totalbalance;
            ViewBag.availablebalance = availablebalance;


            walletbalance = db.GetWalletBalance(userId);


            APIcontroller.CoinsMarketValueController objCoin = new APIcontroller.CoinsMarketValueController();

            try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
            try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
            try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
            try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
            try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
            try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }

            ViewBag.activity      = activity;
            ViewBag.walletbalance = walletbalance;
            ViewBag.coinlist      = coinlist;

            string username                = (string)Session["UserName"];
            SessionTokenGenerationcs Sg    = new SessionTokenGenerationcs();
            UserSessionModel         USobj = new UserSessionModel();
            var Token1 = Sg.Token(USobj);

            if (Token1 == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            return(View(transaction));
        }
        public async Task <ActionResult> ChangePassword(SettingViewMode obj)
        {
            if (!ModelState.IsValid)
            {
                var d = CoinsMarketValueController.GetMarkupWithCoinId();
                foreach (var r in d)
                {
                    switch (r.Key)
                    {
                    case 101: mark101 = r.Value; break;

                    case 102: mark102 = r.Value; break;

                    case 103: mark103 = r.Value; break;

                    case 104: mark104 = r.Value; break;

                    case 105: mark105 = r.Value; break;

                    case 106: mark106 = r.Value; break;
                    }
                }

                try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
                try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
                try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
                try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
                try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
                try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }

                ViewBag.Country = Session["Country"];
                return(View("Settings", obj));
            }
            var userId = User.Identity.GetUserId();

            obj.cp.UserId = userId;
            using (client)
            {
                HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url + "User/" + "ChangePassword", obj);

                if (responseMessage.IsSuccessStatusCode)
                {
                    SettingViewMode obj1 = new SettingViewMode();

                    obj1.cp = new ChangePasswordViewModel();

                    ViewBag.Country       = Session["Country"];
                    ViewBag.StatusMessage = "Your password has been changed.";

                    var d2 = CoinsMarketValueController.GetMarkupWithCoinId();
                    foreach (var r in d2)
                    {
                        switch (r.Key)
                        {
                        case 101: mark101 = r.Value; break;

                        case 102: mark102 = r.Value; break;

                        case 103: mark103 = r.Value; break;

                        case 104: mark104 = r.Value; break;

                        case 105: mark105 = r.Value; break;

                        case 106: mark106 = r.Value; break;
                        }
                    }

                    try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
                    try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
                    try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
                    try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
                    try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
                    try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }

                    return(View("Settings", obj1));
                }
                else
                {
                    string msg = UserController.getmsg;
                    if (msg != null)
                    {
                        ModelState.AddModelError("ch", msg);
                    }
                    //  ModelState.AddModelError("Change", "Server Error. Please contact administrator.");
                }
                var d = CoinsMarketValueController.GetMarkupWithCoinId();
                foreach (var r in d)
                {
                    switch (r.Key)
                    {
                    case 101: mark101 = r.Value; break;

                    case 102: mark102 = r.Value; break;

                    case 103: mark103 = r.Value; break;

                    case 104: mark104 = r.Value; break;

                    case 105: mark105 = r.Value; break;

                    case 106: mark106 = r.Value; break;
                    }
                }

                try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
                try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
                try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
                try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
                try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
                try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }
                ViewBag.Country = Session["Country"];
                return(View("Settings", obj));
            }
        }
        public ActionResult SessionTimeout(SettingViewMode obj)
        {
            string time = obj.lg.LogoutTime;

            if (System.Web.HttpContext.Current.Session.Timeout > 0 && Session["UserName"] != null)
            {
                switch (time)
                {
                case "5 Min":
                    Session.Timeout = 5;
                    break;

                case "10 Min":
                    Session.Timeout = 10;
                    break;

                case "15 Min":
                    Session.Timeout = 15;
                    break;

                case "30 Min":
                    Session.Timeout = 30;
                    break;

                default:
                    Session.Timeout = 20;
                    break;
                }
                ViewBag.res     = "You will logout after" + time;
                ViewBag.Country = Session["Country"];
                var d1 = CoinsMarketValueController.GetMarkupWithCoinId();
                foreach (var r in d1)
                {
                    switch (r.Key)
                    {
                    case 101: mark101 = r.Value; break;

                    case 102: mark102 = r.Value; break;

                    case 103: mark103 = r.Value; break;

                    case 104: mark104 = r.Value; break;

                    case 105: mark105 = r.Value; break;

                    case 106: mark106 = r.Value; break;
                    }
                }

                try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
                try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
                try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
                try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
                try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
                try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }
                return(View("Settings"));
            }
            ViewBag.Country = Session["Country"];
            var d = CoinsMarketValueController.GetMarkupWithCoinId();

            foreach (var r in d)
            {
                switch (r.Key)
                {
                case 101: mark101 = r.Value; break;

                case 102: mark102 = r.Value; break;

                case 103: mark103 = r.Value; break;

                case 104: mark104 = r.Value; break;

                case 105: mark105 = r.Value; break;

                case 106: mark106 = r.Value; break;
                }
            }

            try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
            try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
            try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
            try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
            try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
            try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }
            return(View("Settings"));
        }
Beispiel #10
0
        // [ActionName("PostSaveReceive")]
        public ActionResult RecieveBitcoin(RecieveBitcoinViewModel obj)
        {
            // string CoinName = Request.Form["CoinTypeId"];
            string CoinName = Request["CoinName"];

            obj.QRCode             = Request["Address"];
            obj.DestinationBitcoin = "Sample";
            if (!ModelState.IsValid)
            {
                var d1 = CoinsMarketValueController.GetMarkupWithCoinId();
                foreach (var r in d1)
                {
                    switch (r.Key)
                    {
                    case 101: mark101 = r.Value; break;

                    case 102: mark102 = r.Value; break;

                    case 103: mark103 = r.Value; break;

                    case 104: mark104 = r.Value; break;

                    case 105: mark105 = r.Value; break;

                    case 106: mark106 = r.Value; break;
                    }
                }

                try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
                try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
                try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
                try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
                try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
                try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }
                return(View(obj));
            }

            var userId = User.Identity.GetUserId();

            obj.UserId = userId;
            // using (var scope = new TransactionScope())
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(url + "transaction/ReceiveaPost");


                    //HTTP POST
                    var postTask = client.PostAsJsonAsync(url + "transaction/ReceiveaPost", obj);
                    postTask.Wait();

                    var result = postTask.Result;
                    if (result.IsSuccessStatusCode)
                    {
                        string message = "Hi, this " + Session["Email"] as string + " wants " + obj.AmtInCoins + " " + CoinName + " and Coin Address is " + Request["Address"];
                        SendMail.Mail(obj.RecievedToEmail, message);
                        //return RedirectToAction("Index");
                        EmailNotification en = Session["Notification"] as EmailNotification;
                        if (en != null)
                        {
                            if (en.Receive == true)
                            {
                                string uname = Session["UserName"] as string;
                                string Email = Session["Email"] as string;
                                string res   = "Hi," + uname + " you sent Recieve coin requist. ";
                                //SendMail a = new Blockchaninaccounts.App_Start.SendMail();
                                SendMail.Mail(Email, res);
                            }
                        }
                        ViewBag.msg = "Receive Request successful...!";

                        var d2 = CoinsMarketValueController.GetMarkupWithCoinId();
                        foreach (var r in d2)
                        {
                            switch (r.Key)
                            {
                            case 101: mark101 = r.Value; break;

                            case 102: mark102 = r.Value; break;

                            case 103: mark103 = r.Value; break;

                            case 104: mark104 = r.Value; break;

                            case 105: mark105 = r.Value; break;

                            case 106: mark106 = r.Value; break;
                            }
                        }

                        try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
                        try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
                        try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
                        try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
                        try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
                        try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }
                        ModelState.Clear();
                        return(View("DashboardSuccess"));
                    }
                    //else
                    //{
                    //    ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator.");
                    //}
                }
            }

            ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator.");
            // ModelState.Clear();
            ViewBag.Coinlist = Session["a"];

            var d = CoinsMarketValueController.GetMarkupWithCoinId();

            foreach (var r in d)
            {
                switch (r.Key)
                {
                case 101: mark101 = r.Value; break;

                case 102: mark102 = r.Value; break;

                case 103: mark103 = r.Value; break;

                case 104: mark104 = r.Value; break;

                case 105: mark105 = r.Value; break;

                case 106: mark106 = r.Value; break;
                }
            }

            try { ViewBag.BTC = "$" + Math.Round((Convert.ToDecimal(objCoin.BTCCurrentPrice()) + Convert.ToDecimal(mark101)), 2); } catch (Exception ex) { ViewBag.BTC = ex.Message; }
            try { ViewBag.ETH = "$" + Math.Round((Convert.ToDecimal(objCoin.ETHCurrentPrice()) + Convert.ToDecimal(mark106)), 2); } catch (Exception ex) { ViewBag.ETH = ex.Message; }
            try { ViewBag.DASH = "$" + Math.Round((Convert.ToDecimal(objCoin.DASHCurrentPrice()) + Convert.ToDecimal(mark102)), 2); } catch (Exception ex) { ViewBag.DASH = ex.Message; }
            try { ViewBag.LTC = "$" + Math.Round((Convert.ToDecimal(objCoin.LTCCurrentPrice()) + Convert.ToDecimal(mark103)), 2); } catch (Exception ex) { ViewBag.LTC = ex.Message; }
            try { ViewBag.ETC = "$" + Math.Round((Convert.ToDecimal(objCoin.ETCCurrentPrice()) + Convert.ToDecimal(mark105)), 2); } catch (Exception ex) { ViewBag.ETC = ex.Message; }
            try { ViewBag.MBC = "$" + Math.Round((Convert.ToDecimal(objCoin.GetMBC_USDCoin()) + Convert.ToDecimal(mark104)), 2); } catch (Exception ex) { ViewBag.MBC = ex.Message; }

            return(View(obj));
        }