public void SaveCategoryBudget(Category_BudgetDTO dto)
 {
     _budgetServices.SaveCategoryBudget(dto);
 }
Esempio n. 2
0
        public void SaveCategoryBudget(Category_BudgetDTO dto)
        {
            var category = new CategoryDTO {
                Account_AccountID = dto.Account_AccountID,
                CategoryID = dto.Category_CategoryID,
                Name = dto.CategoryName,
                Type = CategoryTypeDTO.Expense // TODO: Is this always the case?
            };

            _categoryServices.Save(category);

            dto.Category_CategoryID = category.CategoryID;

            var cb = _categories_budgets.Get(dto.Budget_BudgetID, dto.Category_CategoryID);

            if (cb != null)
            {
                dto.MapTo(cb);
                _categories_budgets.Update(cb);
            }
            else
            {
                cb = _categories_budgets.Add(dto.MapTo<Category_Budget>());
            }
        }