示例#1
0
        public async Task <IActionResult> Create()
        {
            IEnumerable <SupportedBankVM> supportedBankVMs = (await _supportedBankService.GetAllSupportedBanksAsync()).ToSupportedBankVMs();
            WalletVM emptyWallet = new WalletVM();
            var      pageVM      = new UpsertWalletVM(emptyWallet, supportedBankVMs);

            return(View(pageVM));
        }
示例#2
0
        public IActionResult Create(WalletVM walletVM)
        {
            var viewModel = new WalletVM();

            viewModel.Type = new WalletTypeVM();
            //viewModel.Type = _service.get //get list of wallet types
            return(View(viewModel));
        }
示例#3
0
 private void btnOpen_Click_1(object sender, RoutedEventArgs e)
 {
     if (_myVM.CloseCommand())
     {
         WalletVM wallet = WalletVM.OpenCommand();
         if (wallet != null)
         {
             SetMyVM(wallet);
         }
     }
 }
示例#4
0
    protected void onFileOpen(object sender, EventArgs e)
    {
        var password = passwordBox.Text;

        if (_myVM.CloseCommand())
        {
            WalletVM wallet = WalletVM.OpenCommand(password);
            if (wallet != null)
            {
                SetMyVM(wallet);
            }
        }
    }
 protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
 {
     if (App.MyWallet != null)
     {
         _myVM = App.MyWallet;
         _myVM.OnWalletDeleted += new EventHandler(_myVM_OnWalletDeleted);
         this.DataContext       = _myVM;
     }
     else
     {
         NavigationService.GoBack(); //NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
     }
     base.OnNavigatedTo(e);
 }
示例#6
0
        public async Task <decimal> updateWallet(WalletVM wallet)
        {
            var user = await _context.Users.FindAsync(wallet.Id);

            if (user != null)
            {
                user.WalletAmt += wallet.Amt;
                var status = await _context.SaveChangesAsync();

                if (status > 0)
                {
                    return(user.WalletAmt);
                }
                return(user.WalletAmt);
            }
            return(user.WalletAmt);
        }
示例#7
0
        public async Task <IActionResult> Info(string password, string uniqueMasterCitizenNumber)
        {
            WalletInfoVM walletInfo;

            try
            {
                WalletDTO walletDTO = await _walletService.GetWalletByUniqueMasterCitizenNumberAndPassword(uniqueMasterCitizenNumber, password);

                var walletVM = new WalletVM(walletDTO);
                walletInfo = new WalletInfoVM(uniqueMasterCitizenNumber, password, "", true, walletVM);
                return(View(walletInfo));
            }
            catch (Exception)
            {
                walletInfo = new WalletInfoVM(uniqueMasterCitizenNumber, password, "Enter valid unique master citizen number and password", false, new WalletVM());
                return(View(walletInfo));
            }
        }
示例#8
0
    private void SetMyVM(WalletVM vm)
    {
        _myVM = vm;
        _myVM.ResetChanges();
        this.DataContext = _myVM;

        if (_myVM.SelectedItem == null)
        {
            txtTitle.Text          = "";
            txtContent.Buffer.Text = "";
        }
        else
        {
            txtTitle.Text          = _myVM.SelectedItem.Title;
            txtContent.Buffer.Text = _myVM.SelectedItem.Content;
        }

        updateTreeview();
    }
        public async Task <IActionResult> CreateWallet(WalletVM walletVM)
        {
            string pass;

            try
            {
                pass = await WalletService.CreateWallet(walletVM.JMBG, walletVM.FirstName, walletVM.LastName, walletVM.BankType, walletVM.BankAccountNumber, walletVM.BankPIN);

                ModelState.Clear();
                ViewData["Success"]    = "True";
                ViewData["WalletPASS"] = pass;
                return(View());
            }
            catch (Exception ex)
            {
                ViewData["ErrorMessage"] = ex.Message;
                ViewData["Success"]      = "False";
                return(View());
            }
        }
        public async Task <IActionResult> Create(WalletVM walletVM)
        {
            string password;

            try
            {
                password = await WalletService.CreateWallet(walletVM.FirstName, walletVM.LastName, walletVM.Jmbg, walletVM.BankType, walletVM.PIN, walletVM.BankAccount);

                ModelState.Clear();
                return(View(new WalletVM()
                {
                    Password = password
                }));
            }
            catch (Exception ex)
            {
                ViewData["IsSuccessful"] = "no";
                ViewData["ErrorMessage"] = ex.Message;

                return(View());
            }
        }
示例#11
0
        public async Task <IActionResult> Create(WalletVM wallet)
        {
            try
            {
                WalletDTO createdWallet = await _walletService.CreateNewWallet(wallet.UniqueMasterCitizenNumber,
                                                                               wallet.PostalIndexNumber,
                                                                               wallet.SupportedBankId,
                                                                               wallet.FirstName,
                                                                               wallet.LastName);

                IEnumerable <SupportedBankVM> supportedBankVMs = (await _supportedBankService.GetAllSupportedBanksAsync()).ToSupportedBankVMs();
                var pageVM = new UpsertWalletVM(wallet, supportedBankVMs);
                ViewData["Success"] = $"Your password is {createdWallet.Password}";
                return(View(pageVM));
            }
            catch (Exception e)
            {
                IEnumerable <SupportedBankVM> supportedBankVMs = (await _supportedBankService.GetAllSupportedBanksAsync()).ToSupportedBankVMs();
                var pageVM = new UpsertWalletVM(wallet, supportedBankVMs);
                ViewData["Error"] = e.Message;
                return(View(pageVM));
            }
        }
示例#12
0
 private void SetMyVM(WalletVM vm)
 {
     _myVM = vm;
     _myVM.ResetChanges();
     this.DataContext = _myVM;
 }
示例#13
0
        public async Task <ActionResult> updateWallet(WalletVM wallet)
        {
            var result = await _domain.updateWallet(wallet);

            return(Ok(result));
        }