public async Task <List <CheckingAccounts> > ReadChecking(string email) { try { List <CheckingAccounts> checkingAccounts = null; using (var con = await DataConnection.Connection()) { var cmd = DataConnection.Command(con, "sp_GetCheckingAccount_ByEmail", CommandType.StoredProcedure); cmd.Parameters.AddWithValue("@Email", email); SqlDataReader sdr = await cmd.ExecuteReaderAsync(); if (sdr.HasRows) { checkingAccounts = new List <CheckingAccounts>(); while (await sdr.ReadAsync()) { CheckingAccounts obj = new CheckingAccounts(); obj.AccountId = int.Parse(sdr["ID"].ToString()); obj.Account = new Accounts(); obj.Account.Id = int.Parse(sdr["ID"].ToString()); obj.Account.AccountNumber = sdr["AccountNumber"].ToString(); obj.Account.CardNumber = sdr["CardNumber"].ToString(); checkingAccounts.Add(obj); } } return(checkingAccounts); } } catch (Exception) { return(null); } }
public BillPayModel(MorningBankRazor.Models.MyBankContext context, IHttpContextAccessor httpContextAccessor) { _context = context; _httpContextAccessor = httpContextAccessor; transactionHistories = new TransactionHistories(); var userName = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.Name).Value; checkingacct = _context.CheckingAccounts.FirstOrDefault(c => c.Username == userName); }
public async Task <IActionResult> InsertCheckingAccount(CheckingAccounts obj) { obj.Account.StartDate = DateTime.Now; if (await _accountRepository.Insert(obj) != null) { return(RedirectToAction("AccountsList")); } ViewBag.ErrorTitle = $"Error"; ViewBag.ErrorMessage = $"Not Register"; return(View("Error")); }
public async Task <CheckingAccounts> CheckingAccountsDetails(string id) { Accounts acc = await _context.Accounts.FirstOrDefaultAsync(acc => acc.AccountNumber == id); EntityLayer.Persons.Persons person = await _context.Persons.FirstOrDefaultAsync(pr => pr.Id == acc.ClientId); CheckingAccounts checking = await _context.CheckingAccounts.FirstOrDefaultAsync(ch => ch.Account.AccountNumber == id); acc.Client = person; checking.Account = acc; return(checking); }
public async Task <ActionResult <CheckingAccounts> > Insert(CheckingAccounts obj) { try { await _context.CheckingAccounts.AddAsync(obj); if (await _context.SaveChangesAsync() > 0) { return(obj); } return(null); } catch (Exception) { return(null); } }
public async Task <ActionResult <CheckingAccounts> > Update(CheckingAccounts obj) { try { var account = _context.Accounts.Attach(obj.Account); account.State = EntityState.Modified; var checkinggaccount = _context.CheckingAccounts.Attach(obj); checkinggaccount.State = EntityState.Modified; if (await _context.SaveChangesAsync() > 0) { return(obj); } else { return(null); } } catch (Exception) { return(null); } }
public async Task <IActionResult> CheckingAccountDetails(string id) { CheckingAccounts obj = await _accountRepository.CheckingAccountsDetails(id); return(View(obj)); }