Example #1
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            if (Double.TryParse(price.Text, out double amount))
            {
                Category currentCategory = categoryRepository.GetItems().Find(c => c.Name == category);

                Expense expense = new Expense();
                expense.CategoryId    = currentCategory.Id;
                expense.AmountOfMoney = Double.Parse(price.Text);
                expense.Date          = date;
                expense.UserId        = controller.user.Id;

                expenseRepository.Create(expense);

                expensePage.UpdateProgressBar();
                this.Close();
            }
            else
            {
                MessageBox.Show("Wrong price entered.");
            }
        }