public async Task <IActionResult> Create([Bind("IncomeAmount,IncomeCategory,IncomeDate,ExpSource")] TblIncome tblIncome) { if (ModelState.IsValid) { _context.Add(tblIncome); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IncomeCategory"] = new SelectList(_context.TblCategories, "CategoryId", "CategoryName", tblIncome.IncomeCategory); return(View(tblIncome)); }
public bool AddExpense(TblExpenditure expense) { try { _context.Add(expense); _context.SaveChanges(); return(true); } catch (Exception Ex) { return(false); } }
public bool AddCategory(TblCategory category) { try { var isCateogryAdded = _context.Add(category); _context.SaveChanges(); if (isCateogryAdded.State.ToString().Equals("Added")) { return(true); } else { return(false); } } catch (Exception Ex) { return(false); } }