Exemplo n.º 1
0
 public ActionResult Index()
 {
     var budgets = Service.Budgets.GetAllForHousehold(true);
     var categories = Service.Categories.GetAllForHousehold(true);
     var model = new BudgetViewModel();
     model.CurrentBudgets = budgets;
     model.Categories = new SelectList(categories, "Id", "Name");
     return View(model);
 }
Exemplo n.º 2
0
        public ActionResult Index(BudgetViewModel model)
        {
            var budget = new Budget();
            model.CopyProperties(budget);
            budget.HouseholdId = GetHouseholdIdForCurrentUser();
            Service.Budgets.Upsert(budget);
            // Save the map
            var map = new BudgetCategoryMap();
            map.BudgetId = budget.Id;
            map.CategoryId = model.CategoryId;
            Service.BudgetCategoryMaps.Upsert(map);

            model.CurrentBudgets = Service.Budgets.GetAllForHousehold(true);
            var categories = Service.Categories.GetAllForHousehold(true);
            model.Categories = new SelectList(categories, "Name", "Name");
            return PartialView("BudgetListPartial", new BudgetListViewModel(model.CurrentBudgets));
        }