Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("CustomerID,Email,Password,Name,LastName,Phone")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("AccountID,AccountType,Balance,CustomerID")] Account account)
        {
            if (ModelState.IsValid)
            {
                _context.Add(account);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerID"] = new SelectList(_context.Customer, "CustomerID", "Email", account.CustomerID);
            return(View(account));
        }
        public async Task <IActionResult> Create([Bind("TransactionID,AccountID,ProcessingDate,Balance,CRorDR,Amount,Description1")] Transaction transaction)
        {
            if (ModelState.IsValid)
            {
                _context.Add(transaction);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccountID"] = new SelectList(_context.Account, "AccountID", "AccountID", transaction.AccountID);
            return(View(transaction));
        }