public async Task <IActionResult> Edit(long id, [Bind("Id,IncomeTypeId,TotalIncome,TaxAmount")] TaxTransaction taxTransaction) { if (id != taxTransaction.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(taxTransaction); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaxTransactionExists(taxTransaction.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IncomeTypeId"] = new SelectList(_context.IncomeTypes, "Id", "Name", taxTransaction.IncomeTypeId); return(View(taxTransaction)); }
public async Task <IActionResult> Create([Bind("Id,IncomeTypeId,TotalIncome,TaxAmount")] TaxTransaction taxTransaction) { if (ModelState.IsValid) { _context.Add(taxTransaction); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IncomeTypeId"] = new SelectList(_context.IncomeTypes, "Id", "Name", taxTransaction.IncomeTypeId); return(View(taxTransaction)); }