示例#1
0
        public ActionResult Categories(BudgetCategoryViewModel model)
        {
            var map = new BudgetCategoryMap();
            map.BudgetId = model.BudgetId;
            map.CategoryId = model.CategoryId;
            Service.BudgetCategoryMaps.Upsert(map);

            var categories = Service.Categories.GetAllForBudget(model.BudgetId);
            return PartialView("BudgetCategoryListPartial", new BudgetCategoryListViewModel(categories));
        }
示例#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));
        }