Пример #1
0
        public ActionResult Create(Expense expense)
        {
            var expenseTypes = repository.GetExpenseTypes();

            ViewData["ExpenseTypes"] = new SelectList(expenseTypes, "ExpenseTypeId", "Description");

            if (ModelState.IsValid)
            {
                repository.Add(expense);
                repository.Save();

                return(RedirectToAction("Index"));
            }

            return(View(expense));
        }
        public ActionResult Create(Income Income)
        {
            var incomeTypes = repository.GetIncomeTypes();

            ViewData["IncomeTypes"] = new SelectList(incomeTypes, "IncomeTypeId", "Description");

            if (ModelState.IsValid)
            {
                repository.Add(Income);
                repository.Save();

                return(RedirectToAction("Index"));
            }

            return(View(Income));
        }