public async Task <IActionResult> Edit(int id, [Bind("IncomeId,IncomeAmount,IncomeCategory,IncomeDate,ExpSource")] TblIncome tblIncome) { if (id != tblIncome.IncomeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tblIncome); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TblIncomeExists(tblIncome.IncomeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IncomeCategory"] = new SelectList(_context.TblCategories, "CategoryId", "CategoryName", tblIncome.IncomeCategory); return(View(tblIncome)); }
public bool UpdateExpense(TblExpenditure newExpense) { try { _context.Update(newExpense); _context.SaveChanges(); return(true); } catch (Exception Ex) { return(false); } }
public bool UpdateCategory(TblCategory category) { try { var isCategoryUpdated = _context.Update(category); _context.SaveChanges(); if (isCategoryUpdated.State.ToString().Equals("Modified")) { return(true); } else { return(false); } } catch (Exception Ex) { return(false); } }