コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("id,IntroducerID,AccountName,CurrencyID,AccountTypeID,AccountHolderName,AccountHolderAddress,AccountNo,IBAN,BSB,BankCode,BankName,SWIFT,CountryID,BranchAddress,Reference,DateTimeModified,DateTimeAdded")] IntroducerBankAccount introducerBankAccount)
        {
            if (id != introducerBankAccount.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    introducerBankAccount.DateTimeModified = Utility.GetLocalDateTime();
                    _context.Update(introducerBankAccount);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IntroducerBankAccountExists(introducerBankAccount.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.Introducer  = new SelectList(_context.Introducer.OrderBy(m => m.IntroducerName).ToList(), "id", "IntroducerName");
            ViewBag.Currency    = new SelectList(_context.Currency.OrderBy(m => m.CurrencyName).ToList(), "id", "CurrencyName");
            ViewBag.AccountType = new SelectList(_context.AccountType.ToList(), "id", "AccountTypeName");
            ViewBag.Country     = new SelectList(_context.Country.OrderBy(m => m.CountryName).ToList(), "id", "CountryName");

            return(View(introducerBankAccount));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("id,IntroducerID,AccountName,CurrencyID,AccountTypeID,AccountHolderName,AccountHolderAddress,AccountNo,IBAN,BSB,BankCode,BankName,SWIFT,CountryID,BranchAddress,Reference,DateTimeModified,DateTimeAdded")] IntroducerBankAccount introducerBankAccount)
        {
            if (ModelState.IsValid)
            {
                introducerBankAccount.DateTimeModified = Utility.GetLocalDateTime();
                introducerBankAccount.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(introducerBankAccount);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.Introducer  = new SelectList(_context.Introducer.OrderBy(m => m.IntroducerName).ToList(), "id", "IntroducerName");
            ViewBag.Currency    = new SelectList(_context.Currency.OrderBy(m => m.CurrencyName).ToList(), "id", "CurrencyName");
            ViewBag.AccountType = new SelectList(_context.AccountType.ToList(), "id", "AccountTypeName");
            ViewBag.Country     = new SelectList(_context.Country.OrderBy(m => m.CountryName).ToList(), "id", "CountryName");

            return(View(introducerBankAccount));
        }