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));
        }
예제 #2
0
        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);
        }
예제 #3
0
        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));
        }
예제 #5
0
        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));
        }
예제 #6
0
 public async Task <Account> InsertAsync(Account account)
 {
     _context.Add(account);
     try
     {
         await _context.SaveChangesAsync();
     }
     catch (Exception)
     {
     }
     return(account);
 }
예제 #7
0
        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();
        }
예제 #9
0
        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 });
        }
예제 #10
0
        public async Task Add(BankDetail item)
        {
            await _context.Set <BankDetail>().AddAsync(item);

            await _context.SaveChangesAsync();
        }