public async Task <IActionResult> Edit(int id, [Bind("DebtId,PersonId,DebtTitle,RepaymentDate,BillAmount,DebtNote,CurrentAmount,InterestRate")] CcdDebt ccdDebt) { if (id != ccdDebt.DebtId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ccdDebt); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CcdDebtExists(ccdDebt.DebtId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PersonId"] = new SelectList(_context.CcdPerson, "PersonId", "PersonName", ccdDebt.PersonId); return(PartialView("~/Areas/CreditCard/Views/CcdDebt/CreateEdit.cshtml", ccdDebt)); }
public async Task <IActionResult> Create([Bind("DebtId,PersonId,DebtTitle,RepaymentDate,BillAmount,DebtNote,CurrentAmount,InterestRate")] CcdDebt ccdDebt) { if (ModelState.IsValid) { _context.Add(ccdDebt); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PersonId"] = new SelectList(_context.CcdPerson, "PersonId", "PersonName", ccdDebt.PersonId); return(PartialView("~/Areas/CreditCard/Views/CcdDebt/CreateEdit.cshtml", ccdDebt)); }