Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("id,ClientID,AccountName,CurrencyID,AccountTypeID,AccountHolderName,AccountHolderAddress,AccountNo,IBAN,BSB,BankCode,BankName,SWIFT,CountryID,BranchAddress,Reference,DateTimeModified,DateTimeAdded")] ClientBankAccount clientBankAccount)
        {
            if (id != clientBankAccount.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    clientBankAccount.DateTimeModified = Utility.GetLocalDateTime();
                    _context.Update(clientBankAccount);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientBankAccountExists(clientBankAccount.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.Client      = new SelectList(_context.Client.OrderBy(m => m.ClientName).ToList(), "id", "ClientName");
            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(clientBankAccount));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("id,ClientID,AccountName,CurrencyID,AccountTypeID,AccountHolderName,AccountHolderAddress,AccountNo,IBAN,BSB,BankCode,BankName,SWIFT,CountryID,BranchAddress,Reference,DateTimeModified,DateTimeAdded")] ClientBankAccount clientBankAccount)
        {
            if (ModelState.IsValid)
            {
                clientBankAccount.DateTimeModified = Utility.GetLocalDateTime();
                clientBankAccount.DateTimeAdded    = Utility.GetLocalDateTime();
                _context.Add(clientBankAccount);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.Client      = new SelectList(_context.Client.OrderBy(m => m.ClientName).ToList(), "id", "ClientName");
            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(clientBankAccount));
        }