public IActionResult Edit(int id, [Bind("Expid,ExpAmount,ExpCategory,ExpAccount,ExpDate,ExpShop")] TblExpenditure expense) { if (ModelState.IsValid) { _expService.UpdateExpense(expense); return(RedirectToAction(nameof(Index))); } ViewData["ExpCategory"] = new SelectList(_expService.GetAllCategories(), "CategoryId", "CategoryName", expense.ExpCategory); ViewData["ExpAccount"] = new SelectList(_expService.GetAllAccounts(), "AccountId", "AccountBankName", expense.ExpAccount); return(View(expense)); }
public bool AddExpense(TblExpenditure expense) { try { _context.Add(expense); _context.SaveChanges(); return(true); } catch (Exception Ex) { return(false); } }
public bool UpdateExpense(TblExpenditure newExpense) { try { _context.Update(newExpense); _context.SaveChanges(); return(true); } catch (Exception Ex) { return(false); } }
public bool GetExpense(TblExpenditure expense) { throw new NotImplementedException(); }
public bool RemoveExpense(TblExpenditure expense) => _expRepo.RemoveExpense(expense);
public bool GetExpense(TblExpenditure expense) => _expRepo.GetExpense(expense);
public bool UpdateExpense(TblExpenditure expense) => _expRepo.UpdateExpense(expense);
public bool AddExpense(TblExpenditure expense) => _expRepo.AddExpense(expense);