public ActionResult Edit(Expense expense) { if (ModelState.IsValid) { db.Entry(expense).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.TypeId = new SelectList(db.ExpenseTypes, "Id", "Name", expense.TypeId); return View(expense); }
public ActionResult Create(Expense expense) { if (ModelState.IsValid) { db.Expenses.Add(expense); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.TypeId = new SelectList(db.ExpenseTypes, "Id", "Name", expense.TypeId); return View(expense); }