コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("CreditCardId,PersonId,IssuingBank,CreditCardNumber,Limit,Temporary,TempDate,AccountBill,RepaymentDate,BillAmount,ValidThru,Cvv,TransactionPw,InquriyPw,OnlineBankingPw")] CcdData ccdData)
        {
            if (id != ccdData.CreditCardId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ccdData);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CcdDataExists(ccdData.CreditCardId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId"] = new SelectList(_context.CcdPerson, "PersonId", "PersonName", ccdData.PersonId);
            return(PartialView("~/Areas/CreditCard/Views/CcdData/CreateEdit.cshtml", ccdData));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("CreditCardId,PersonId,IssuingBank,CreditCardNumber,Limit,Temporary,TempDate,AccountBill,RepaymentDate,BillAmount,ValidThru,Cvv,TransactionPw,InquriyPw,OnlineBankingPw")] CcdData ccdData)
        {
            if (ModelState.IsValid)
            {
                ccdData.PrePayment = 0;
                ccdData.HasPayment = 0;
                _context.Add(ccdData);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId"] = new SelectList(_context.CcdPerson, "PersonId", "PersonName", ccdData.PersonId);
            return(PartialView("~/Areas/CreditCard/Views/CcdData/CreateEdit.cshtml", ccdData));
        }