public async Task <IActionResult> Create([Bind("ContactDetailId,Adress,City,Country,PhoneNo,AlternatePhoneNo,Email")] ContactDetails contactDetail) { if (ModelState.IsValid) { _context.Add(contactDetail); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(contactDetail)); }
public async Task <Boolean> DeleteAccountById(Int64 id) { Account account = await BankingDbContext.Accounts.Select(a => a).Where(a => a.Id == id).SingleAsync(); account.isActive = false; account.isDeleted = true; BankingDbContext.Accounts.Update(account); await BankingDbContext.SaveChangesAsync(); return(true); }
public async Task <IActionResult> Create([Bind("TransactionId,ExternalIBAN,ExternalName,Amount,Time,Details,Status")] Transaction transaction) { if (ModelState.IsValid) { _context.Add(transaction); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(transaction)); }
public async Task <IActionResult> Create([Bind("RequestId,Type,SendDate")] Request request) { if (ModelState.IsValid) { _context.Add(request); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(request)); }
public async Task <IActionResult> Create([Bind("LoanId,Value,StartDate,EndDate,LunarFee")] Loan loan) { if (ModelState.IsValid) { _context.Add(loan); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(loan)); }
public async Task <Account> InsertAsync(Account account) { _context.Add(account); try { await _context.SaveChangesAsync(); } catch (Exception) { } return(account); }
private Task SaveEventAsync(IntegrationEvent @event, IDbContextTransaction transaction) { if (transaction == null) { throw new ArgumentNullException(nameof(transaction)); } var eventLogEntry = new IntegrationEventLog(@event, transaction.TransactionId); //if log DbContext is different from the main, pass the current tranmsaction to its DbContext //_bankingDbContext.Database.UseTransaction(transaction.GetDbTransaction()); _bankingDbContext.IntegrationEventLogs.Add(eventLogEntry); return(_bankingDbContext.SaveChangesAsync()); }
public async Task Update(Account account) { account.UpdateDate = DateTime.Now; _context.Accounts.Update(account); await _context.SaveChangesAsync(); }
public async Task <IEnumerable <Account> > Transfer(int requestFrom, int requestTo, decimal requestAmount) { var from = await _context.Accounts.FirstOrDefaultAsync(a => a.Id == requestFrom); var to = await _context.Accounts.FirstOrDefaultAsync(a => a.Id == requestTo); from.AccountBalance -= requestAmount; to.AccountBalance += requestAmount; await _context.SaveChangesAsync(); return(new[] { from, to }); }
public async Task Add(BankDetail item) { await _context.Set <BankDetail>().AddAsync(item); await _context.SaveChangesAsync(); }