public IActionResult Add()
        {
            AddExpenseCategoryViewModel addExpenseCategoryViewModel =
                new AddExpenseCategoryViewModel();

            return(View(addExpenseCategoryViewModel));
        }
        public AddExpenseCategoryWindow()
        {
            InitializeComponent();

            AddExpenseCategoryViewModel vm = new AddExpenseCategoryViewModel();

            this.DataContext = vm;
            if (vm.CloseAction == null)
            {
                vm.CloseAction = new Action(this.Close);
            }
        }
        public IActionResult Add(AddExpenseCategoryViewModel addExpenseCategoryViewModel)
        {
            if (ModelState.IsValid)
            {
                ExpenseCategory newCategory = new ExpenseCategory
                {
                    Name = addExpenseCategoryViewModel.Name,
                };

                context.ExpenseCategories.Add(newCategory);
                context.SaveChanges();

                return(Redirect("/ExpenseCategory"));
            }

            return(View(addExpenseCategoryViewModel));
        }