public ActionResult Create(ExpenseCategory expensecategory)
        {
            if (ModelState.IsValid)
            {
                db.ExpenseCategories.Add(expensecategory);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(expensecategory);
        }
        public void Update(int id, ExpenseCategory item)
        {
            var expenseCategory = Context.ExpenseCategories.FirstOrDefault(x => x.Id.Equals(id));

            if (expenseCategory == null)
            {
                throw new InvalidOperationException();
            }

            expenseCategory.Name = item.Name;
            expenseCategory.Description = item.Description;

            Context.SaveChanges();
        }
 public ActionResult Edit(ExpenseCategory expensecategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(expensecategory).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(expensecategory);
 }
 public void Create(ExpenseCategory item)
 {
     item = Context.ExpenseCategories.Add(item);
     Context.SaveChanges();
 }