Exemple #1
0
        public ActionResult ConfirmDepositWithDrawal(DepositWithdrawalInfo m)
        {
            CryptoBankServiceSoapClient x = new CryptoBankServiceSoapClient();

            x.MakeDepositWIthdrawal(loggedInUser.accountnumber, m.amount, m.deposit);
            return(View("~/Views/Home/Index.cshtml"));
        }
        public ActionResult Register(UserModel user)
        {
            UserModel registerUSer = user;

            registerUSer.accountnumber = "NL01CRYPTO" + new Random().Next(000100000, 999999999);
            registerUSer.balance       = 0;
            if (ModelState.IsValid)
            {
                CryptoBankServiceSoapClient webservice = new CryptoBankServiceSoapClient();
                webservice.RegisterUser(registerUSer);
                return(RedirectToAction("Login"));
            }
            return(View(user));
        }
 public ActionResult Login(UserModel user)
 {
     System.Diagnostics.Debug.WriteLine(user.email + " " + user.password);
     //check with database
     CryptoBankServiceSoapClient webService = new CryptoBankServiceSoapClient();
     if (webService.ValidateLogin(user.email, user.password))
     {
         loggedInUser = webService.GetUserByLogin(user.email, user.password);
         Session["LoggedUserAccountNumber"] = loggedInUser.accountnumber.ToString();
         Session["LoggedUserName"] = loggedInUser.name.ToString();
         return RedirectToAction("Dashboard");
     }
     return View(user);
 }
        public ActionResult Login(UserModel user)
        {
            System.Diagnostics.Debug.WriteLine(user.email + " " + user.password);
            //check with database
            CryptoBankServiceSoapClient webService = new CryptoBankServiceSoapClient();

            if (webService.ValidateLogin(user.email, user.password))
            {
                loggedInUser = webService.GetUserByLogin(user.email, user.password);
                Session["LoggedUserAccountNumber"] = loggedInUser.accountnumber.ToString();
                Session["LoggedUserName"]          = loggedInUser.name.ToString();
                return(RedirectToAction("Dashboard"));
            }
            return(View(user));
        }
        public ActionResult ProcessTransfer(TransferModel tm)
        {
            CryptoBankServiceSoapClient x = new CryptoBankServiceSoapClient();

            string receiverAccountNumber = tm.receiverAccountNumber;
            int amountOfBitCoins = tm.receiverAmount;
            string senderAccountNumber = loggedInUser.accountnumber;


            Debug.WriteLine("amount ; " + amountOfBitCoins.ToString()); 
            Debug.WriteLine("receiver : " + receiverAccountNumber);
            Debug.WriteLine("sender : " + senderAccountNumber);

            senderAccountNumber = Regex.Replace(senderAccountNumber, @"\s+", "");
            receiverAccountNumber = Regex.Replace(receiverAccountNumber, @"\s+", "");
            if (x.TransferMoney(amountOfBitCoins, receiverAccountNumber, senderAccountNumber))
                return RedirectToAction("Transfer", "Home", new { msgid = 1 });
            else
                return RedirectToAction("Transfer", "Home", new { msgid = 0 });
        }
        public ActionResult ProcessTransfer(TransferModel tm)
        {
            CryptoBankServiceSoapClient x = new CryptoBankServiceSoapClient();

            string receiverAccountNumber = tm.receiverAccountNumber;
            int    amountOfBitCoins      = tm.receiverAmount;
            string senderAccountNumber   = loggedInUser.accountnumber;


            Debug.WriteLine("amount ; " + amountOfBitCoins.ToString());
            Debug.WriteLine("receiver : " + receiverAccountNumber);
            Debug.WriteLine("sender : " + senderAccountNumber);

            senderAccountNumber   = Regex.Replace(senderAccountNumber, @"\s+", "");
            receiverAccountNumber = Regex.Replace(receiverAccountNumber, @"\s+", "");
            if (x.TransferMoney(amountOfBitCoins, receiverAccountNumber, senderAccountNumber))
            {
                return(RedirectToAction("Transfer", "Home", new { msgid = 1 }));
            }
            else
            {
                return(RedirectToAction("Transfer", "Home", new { msgid = 0 }));
            }
        }
 public ActionResult Register(UserModel user)
 {
     UserModel registerUSer = user;
     registerUSer.accountnumber = "NL01CRYPTO" + new Random().Next(000100000, 999999999);
     registerUSer.balance = 0;
     if (ModelState.IsValid)
     {
         CryptoBankServiceSoapClient webservice = new CryptoBankServiceSoapClient();
         webservice.RegisterUser(registerUSer);
         return RedirectToAction("Login");
     }
     return View(user);
 }
 public ActionResult ConfirmDepositWithDrawal(DepositWithdrawalInfo m) {
     CryptoBankServiceSoapClient x = new CryptoBankServiceSoapClient();
     x.MakeDepositWIthdrawal(loggedInUser.accountnumber, m.amount, m.deposit);
     return View("~/Views/Home/Index.cshtml");
 }