Пример #1
0
 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);
 }
Пример #2
0
        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);
        }