コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,BankName,FixedDepositPercentage")] Bank bank)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bank);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bank));
        }
        public async Task <IActionResult> Create([Bind("Id,AccountId,NumberOfYears")] CalculatedBalance calculatedBalance)
        {
            if (ModelState.IsValid)
            {
                _context.Add(calculatedBalance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccountId"] = new SelectList(_context.Account, "Id", "Id", calculatedBalance.AccountId);
            return(View(calculatedBalance));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,CustomerName,CustomerNumber,BankId")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BankId"] = new SelectList(_context.Bank, "Id", "Id", customer.BankId);
            return(View(customer));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,AccountNumber,Balance,CustomerId")] Account account)
        {
            if (ModelState.IsValid)
            {
                _context.Add(account);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Set <Customer>(), "Id", "Id", account.CustomerId);
            return(View(account));
        }