private static List <BankAccountsViewModel> GetAllBankAccounts(int orgId) { var bankAccounts = new List <BankAccountsViewModel>(); using (SqlConnection connection = new SqlConnection(_connectionString)) { SqlCommand command = new SqlCommand(Constants.AllBankAccounts, connection); command.Parameters.Add("@orgId", SqlDbType.Int).Value = orgId; connection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { BankAccountsViewModel model = new BankAccountsViewModel { CardNumber = (string)reader["CardNumber"], ExtractMerchantId = (int?)reader["ExtractMerchantId"], ExtractMerchantPassword = (string)reader["ExtractMerchantPassword"] }; bankAccounts.Add(model); } } } return(bankAccounts); }
public async Task <int> UpdateAmount(BankAccountsViewModel modelIn, BankAccountsViewModel modelOut) { _context.Update(modelIn); _context.Update(modelOut); return(await _context.SaveChangesAsync()); }
public async Task <BankAccountsViewModel> GetBankAccountsViewModelAsync() { BankAccountsViewModel vm = new BankAccountsViewModel(this.dbFilePath); await vm.LoadVMAsync(); return(vm); }
protected override void OnDisappearing() { base.OnDisappearing(); vm?.Dispose(); vm = null; chartAllCategories.Chart = null; }
public async Task <IActionResult> Create(BankAccountsViewModel bankAccountsViewModel) { if (ModelState.IsValid && !_bankServices.BankAccountsNameViewModelExists(bankAccountsViewModel.Currency)) { await _bankServices.CreateBank(bankAccountsViewModel); return(RedirectToAction(nameof(Index))); } return(View(bankAccountsViewModel)); }
// GET: BankAccount public ActionResult Index() { SetContextCulture(); var accountJsonModels = GetAccountsFromApi(); var viewModel = new BankAccountsViewModel() { BankAccounts = accountJsonModels, User = GetCurrentUser() }; return(View(viewModel)); }
public async Task <bool> EditAmount(BankAccountsViewModel model) { try { _context.Update(model); await _context.SaveChangesAsync(); return(true); } catch { return(false); } }
public IHttpActionResult GetBankAccounts(int id) { var bankAccounts = DbContext.BankAccounts.Where(b => b.HouseholdId == id) .ProjectTo <BankAccountViewModel>().ToList(); var BAsModel = new BankAccountsViewModel { BankAccounts = bankAccounts, HouseholdName = hBHelper.GetHouseholdById(id).Name, IsOwner = hBHelper.GetHouseholdById(id).OwnerId == User.Identity.GetUserId() }; return(Ok(BAsModel)); }
public async Task <bool> CreateBank(BankAccountsViewModel model) { try { model.Id = Guid.NewGuid(); _context.Add(model); await _context.SaveChangesAsync(); return(true); } catch { return(false); } }
// string acct { get; set; } private async void CarouselViewControl_PositionSelected(object sender, CarouselView.FormsPlugin.Abstractions.PositionSelectedEventArgs e) { try { var obj = (CarouselViewControl)sender; if (obj.BindingContext == null) { return; } vm = (BankAccountsViewModel)obj.BindingContext; if (!vm.IsAccountLoaded) { return; } if (vm.IsAccountLoaded && vm.CustomerAccounts.Count > 1) { var account = vm.CustomerAccounts[e.NewValue]; if (e.NewValue > 0) { vm.CanSwipeRight = true; } else { vm.CanSwipeRight = false; } if (e.NewValue == vm.CustomerAccounts.Count - 1) { vm.CanSwipeLeft = false; } else { vm.CanSwipeLeft = true; } vm.SelectedAccount = account; // acct = account.nuban; await vm.GetTransactionsByNuban(account.nuban, account.currencyCode); } } catch (Exception ex) { } }
protected async override void OnAppearing() { base.OnAppearing(); vm = await ds.GetBankAccountsViewModelAsync(); vm.SelectedBankAccount = null; this.BindingContext = vm; //chartAccountBalances var provider = new MicrochartsProvider <BankAccountsViewModel>(); //chartAccountBalances.Chart = await provider.GetChartAsync(vm, 0, false); chartAllCategories.Chart = await provider.GetChartAsync(vm, 0, false); //chartWithdrawals.Chart = await provider.GetChartAsync(vm, 1, false); }
public BankAccountsView() { InitializeComponent(); BindingContext = _viewModel = new BankAccountsViewModel(); }