public JsonResult UpdateBankAccountDetail([FromBody] BankAccountViewModel viewModel) { _accountHolderAppService.UpdateBankDetails(viewModel.BankName, viewModel.AccountNumber, viewModel.AccountName); return(Json(new { })); }
public ActionResult AddBankAccount(BankAccountViewModel m) { var account = createAnAccount(); var accountLink = createAcountLink(account); return(View(m)); }
public IHttpActionResult EditBankAccount(int id, int bankAccountId, BankAccountViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var currentHousehold = DbContext.Households.FirstOrDefault( house => house.Id == id); var currentBankAccount = currentHousehold.BankAccounts.FirstOrDefault( cat => cat.Id == bankAccountId); var userId = User.Identity.GetUserId(); if (currentHousehold == null || currentBankAccount == null) { return(NotFound()); } if (currentHousehold.CreatedById == userId) { currentBankAccount.Name = model.Name; currentBankAccount.Description = model.Description; currentBankAccount.DateUpdated = DateTime.Today; DbContext.SaveChanges(); return(Ok()); } else { return(NotFound()); } }
public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BankAccount ba = _repo.GetBankAccount(id); if (ba == null) { return(HttpNotFound()); } BankAccountViewModel model = new BankAccountViewModel() { AvailableFunds = ba.AvailableFunds, Balance = ba.Balance, DebitLimit = ba.DebitLimit, Frozen = ba.Frozen, Locks = ba.Locks, OpeningDate = ba.OpeningDate, AccountNumber = ba.AccountNumber, User = ba.User }; return(View(model)); }
public async Task <BankAccountViewModel> GetIndexResponce() { var responce = new BankAccountViewModel(); var cities = await GetCitiesAsync(); foreach (var c in cities) { responce.Cities.Add( new SelectListItem { Value = c.Code.ToString(), Text = c.Description }); } var banks = await GetBanksAsync(); foreach (var bank in banks) { responce.Banks.Add( new SelectListItem { Value = bank.Code.ToString(), Text = bank.Description }); } var branches = await GetAllBranchesAsync(); foreach (var branch in branches) { responce.BankBranches.Add( new SelectListItem { Value = branch.BranchNumber.ToString(), Text = branch.BranchName }); } return(responce); }
// GET: BankAccount/Details/5 public async Task <IActionResult> Details(Guid?id) { if (id == null) { return(NotFound()); } var bankAccount = await _context.BankAccount .SingleOrDefaultAsync(m => m.Id == id); if (bankAccount == null) { return(NotFound()); } var bankAccountsViewModel = new BankAccountViewModel { Id = bankAccount.Id, Username = GetUserNameFromId(bankAccount.OwnerId), Balance = bankAccount.Balance, Comment = bankAccount.Comment, CreationTime = bankAccount.CreationTime, InterestRate = bankAccount.InterestRate, Transactions = bankAccount.Transactions }; return(View(bankAccountsViewModel)); }
public IHttpActionResult EditBankAccount(int id, int bankAccountId) { var currentHousehold = DbContext.Households.FirstOrDefault( house => house.Id == id); var currentBankAccount = currentHousehold.BankAccounts.FirstOrDefault( cat => cat.Id == bankAccountId); var userId = User.Identity.GetUserId(); if (currentHousehold == null || currentBankAccount == null) { return(NotFound()); } if (currentHousehold.CreatedById == userId) { var accountModel = new BankAccountViewModel(); accountModel.Name = currentBankAccount.Name; accountModel.Description = currentBankAccount.Description; accountModel.Id = currentBankAccount.Id; accountModel.HouseholdId = currentBankAccount.HouseHoldId; return(Ok(accountModel)); } else { return(NotFound()); } }
public async Task <Result <BankAccountViewModel> > GetAccount(int id) { BankAccount bankAccount = null; try { bankAccount = await _context.BankAccounts.FirstOrDefaultAsync(ba => ba.ClientID == id); } catch (Exception ex) { //account was not found } if (bankAccount == null) { return(Result.Fail <BankAccountViewModel>(HttpStatusCode.NotFound, "Bank account was not found")); } var accountViewModel = new BankAccountViewModel(bankAccount); var contacts = await _contactsService.GetAllContacts(bankAccount); if (contacts.Success) { accountViewModel.Contacts = contacts.Value; } return(Result.Ok(accountViewModel)); }
public async Task <BankAccountViewModel> GetBankAccountViewModelAsync(int accountId, BankAccountType accountType) { BankAccountViewModel vm = new BankAccountViewModel(this.dbFilePath); await vm.LoadVMAsync(accountId, accountType); return(vm); }
public async Task <IActionResult> AddPlatformBankAccount([FromBody] BankAccountViewModel model) { User user = DataContext.PlatformAccount; BankAccount account = Mapper.Map <BankAccount>(model); BankAccount clone = user.BankAccounts.FirstOrDefault(b => { return(b.BankId == model.BankId && b.AccountNumber == model.AccountNumber); }); if (clone != null) { int index = user.BankAccounts.IndexOf(clone); clone.IsActive = true; user.BankAccounts[index] = account; await DataContext.Store.UpdateOneAsync(user); return(Ok()); } user.BankAccounts.Add(account); await DataContext.Store.UpdateOneAsync(user); return(Ok()); }
public static List <BankAccountViewModel> GetAccounts() { //na WCF List <BankAccountViewModel> accounts = new List <BankAccountViewModel>(); List <string> statusList = new List <string>(); statusList.Add("Aktivan"); statusList.Add("Neaktivan"); statusList.Add("Nepoznat"); for (int i = 0; i < 15; i++) { BankAccountModel account = new BankAccountModel { Id = i, Code = "000" + i.ToString(), IBAN = "RBZSGSGS" + i.ToString(), Name = "AccountName" + i.ToString(), Status = "Neaktivan" }; BankAccountViewModel model = new BankAccountViewModel { Account = account, StatusList = statusList }; accounts.Add(model); } return(accounts); }
public IActionResult BankAccount(BankAccountViewModel model) { int?userid = HttpContext.Session.GetInt32("User"); if (HttpContext.Session.GetInt32("User") != null) { ViewData["Message"] = "Your success page."; BankAccountViewModel vm = model; User user = _dbContext.Users.Include(u => u.Transactions).Where(u => u.UserId == userid).FirstOrDefault(); vm.Transactions = user.Transactions; if (vm.CurrentBalance + vm.DepositOrWithdrawalAmount < 0) { ModelState.AddModelError("DepositOrWithdrawalAmount", "You cant withdraw more than you have!"); } else { Transaction transaction = new Transaction(); transaction.Amount = (int)model.DepositOrWithdrawalAmount; transaction.User = user; vm.CurrentBalance = user.Transactions.Sum(t => t.Amount); _dbContext.Add(transaction); _dbContext.SaveChanges(); } return(View(vm)); } else { return(Redirect("/")); } }
public ActionResult Get(int customerId) { var model = new BankAccountViewModel(); model.CustomerId = customerId; return(PartialView("_BankAccountForm", model)); }
private void ViewerGrid_RowEditEnding(object sender, System.Windows.Controls.DataGridRowEditEndingEventArgs e) { // Save changes and tell other viewers about the change int currow = 0; currow = this.BankGrid.SelectedIndex; // Save current row so we can reposition correctly at end of the entire refresh process Flags.SqlBankCurrentIndex = currow; BankAccountViewModel ss = new BankAccountViewModel(); ss = this.BankGrid.SelectedItem as BankAccountViewModel; // This is the NEW DATA from the current row SQLHandlers sqlh = new SQLHandlers(); sqlh.UpdateDbRowAsync("BANKACCOUNT", ss, this.BankGrid.SelectedIndex); this.BankGrid.SelectedIndex = Flags.SqlBankCurrentIndex; this.BankGrid.ScrollIntoView(Flags.SqlBankCurrentIndex); // Notify EditDb to upgrade its grid if (Flags.CurrentEditDbViewer != null) { Flags.CurrentEditDbViewer.UpdateGrid("BANKACCOUNT"); } // *********** DEFINITE WIN ********** // This DOES trigger a notidfication to SQLDBVIEWER for sure !!! 14/5/21 EventControl.TriggerViewerDataChanged(2, this.BankGrid.SelectedIndex, "BANKACCOUNT"); }
public IActionResult CreateAccount(BankAccountViewModel model) { var allusers = _repository.GetAllBankUser(); ViewBag.BankUsers = allusers; if (ModelState.IsValid) { if (!_ibanService.Validate(model.IBAN)) { ModelState.AddModelError("", "This IBAN is invalid!"); } else if (!_repository.IsIBANNumberExist(model.IBAN)) { var newAccount = _mapper.Map <BankAccountViewModel, BankAccount>(model); newAccount.User = _repository.GetBankUserById(model.UserId); newAccount.Status = AccountStatus.Open; _repository.AddEntity(newAccount); if (_repository.SaveAll()) { ViewBag.Msg = "Create Success!"; } } else { ModelState.AddModelError("", "This IBAN is exist!"); } } return(View(model)); }
public async Task <IActionResult> RegisterAccount(BankAccountViewModel bankAccount) { if (!ModelState.IsValid) { return(View(bankAccount)); } if (!bankAccount.AlertEmail.EndsWith("@gmail.com", StringComparison.OrdinalIgnoreCase)) { ModelState.AddModelError("", "Kindly provide a gmail account for your bank alert email"); return(View(bankAccount)); } var user = await GetCurrentUser(); bool IsExists = _bankAccountService.RegisterBankAccountCheckIfExists (bankAccount.AccountNumber, bankAccount.AppUserId); if (IsExists) { ModelState.AddModelError("", "This Account number has already been registered"); return(View(bankAccount)); } BankAccount account = new BankAccount() { AccountNumber = bankAccount.AccountNumber, AlertEmail = bankAccount.AlertEmail, AppUserId = bankAccount.AppUserId, BankName = bankAccount.BankName }; _bankAccountService.AddBankAccount(account); return(RedirectToAction("GoogleOAuth", "Email", new { accountNumber = account.AccountNumber, userId = account.AppUserId })); }
public int MapViewModelToBAnkAccount(BankAccountViewModel model, string user, bool performSave) { var bankAccount = GetBankAccountById(model.Id); bankAccount = bankAccount == null?Mapper.Map <BankAccountViewModel, BankAccount>(model) : Mapper.Map(model, bankAccount); if (!performSave) { return(bankAccount.Id); } if (bankAccount.Id > 0) { bankAccount.SetUpdateDetails(user); repository.SaveExisting(bankAccount); } else { bankAccount.SetCreateDetails(user); repository.SaveNew(bankAccount); } return(bankAccount.Id); }
public async Task <IActionResult> Edit(Guid id, [Bind("Id,CreationTime,InterestRate,Comment,Balance")] BankAccountViewModel bankAccountViewModel) { if (id != bankAccountViewModel.Id) { return(NotFound()); } if (ModelState.IsValid) { var oldbankAccount = _context.BankAccount.FirstOrDefault(o => o.Id == bankAccountViewModel.Id); oldbankAccount.Comment = bankAccountViewModel.Comment; oldbankAccount.InterestRate = bankAccountViewModel.InterestRate; try { _context.Update(oldbankAccount); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BankAccountExists(oldbankAccount.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(bankAccountViewModel)); }
// GET: BankAccounts/Create public ActionResult Create() { var bankaccountVm = new BankAccountViewModel(); // bankaccountVm.BankAccountsList = _unitOfWork.BankAccountRepo.GetWhere(bankAccount => bankAccount.Id > 0); return(View(bankaccountVm)); }
async Task <Entry[]> GetEntriesAsync(BankAccountViewModel vm, bool fullSize) { Entry[] _entries = new Entry[] { }; _entries = await GetBankAccountEntriesAsync(vm, fullSize); return(await GetBankAccountEntriesAsync(vm, fullSize)); }
// GET: BankAccounts public ActionResult Index() { var userId = User.Identity.GetUserId(); var bankaccountVm = new BankAccountViewModel(); bankaccountVm.BankAccountsList = _unitOfWork.BankAccountRepo.GetWhere(bankAccount => bankAccount.Id > 0 && bankAccount.UserId == userId); return(View(bankaccountVm)); }
public ViewResult List() { BankAccountViewModel accounts = new BankAccountViewModel { Accounts = _repository.Accounts.OrderBy(a => a.BankName) }; return(View(accounts)); }
public ActionResult GetDropDownListOfBankAccountIDs() { var viewModel = new BankAccountViewModel() { BankAccounts = this.bankAccountService.GetAllBankAccounts().ToList() }; return(this.View(viewModel)); }
public virtual ActionResult EditAjax(BankAccountViewModel model) { //TODO Manager Save metoda if (ModelState.IsValid) { } return(Json("Poruka sa AJAX metode: spašeno!!!")); }
public async Task <Chart> GetChartAsync(BankAccountViewModel vm, bool fullSize = false) { var entries = await GetEntriesAsync(vm, fullSize); return(new BarChart() { Entries = entries }); }
// GET: BankAccounts public ActionResult Index() { BankAccountViewModel bankAccountVm = new BankAccountViewModel { BankAccountsList = _bankAccountRepository.GetWhere(x => x.Id > 0) }; return(View("Index", bankAccountVm)); }
public ActionResult DeleteConfirmed(int id) { var bankaccountVm = new BankAccountViewModel(); bankaccountVm.BankAccount = _unitOfWork.BankAccountRepo.GetWhere(bankAccount => bankAccount.Id == id).FirstOrDefault(); _unitOfWork.BankAccountRepo.Delete(bankaccountVm.BankAccount); _unitOfWork.Complete(); return(RedirectToAction("Index")); }
public void SetUp() { var bankAccount = "1"; sut = new BankAccountViewModel { BankAccountName = bankAccount.PadRight(255, '1'), AccountNumber = "ASDFASDFLKJ-", }; }
public ActionResult Edit(BankAccountViewModel bankAccountVm) { if (ModelState.IsValid) { _bankAccountRepository.Update(bankAccountVm.BankAccount); _bankAccountLogic.CalculateBalanceOfAllAccounts(); return(RedirectToAction("Index")); } return(View(bankAccountVm)); }
public ActionResult DeleteConfirmed(int id) { var bankAccountVm = new BankAccountViewModel { BankAccount = _bankAccountRepository.GetWhere(x => x.Id == id).FirstOrDefault() }; _bankAccountRepository.Delete(bankAccountVm.BankAccount); return(RedirectToAction("Index")); }
public void composed_validation_works() { Sut = new BankAccountViewModel { BankAccountName = "ASDFASDF", AccountNumber = "ASDFASDFLKJ-", }; var sut = (BankAccountViewModel) Sut; if (sut == null) return; IEnumerable<Tuple<string, string>> brokenRules; Assert.True(sut.Validate(out brokenRules)); }