A simple budget management application built with ASP.NET Core MVC and Entity Framework Core.
- Transaction Management: Add, update, and delete income/expenses.
- Categorization: Group transactions by categories with visual color coding.
- Dynamic Filtering: Filter transactions by name, date, and category without page reloads.
- AJAX-powered UI: Smooth user experience using AJAX for CRUD operations and filtering.
- Backend: ASP.NET Core 10 (MVC)
- Database: SQL Server with Entity Framework Core
- Frontend: Razor Views, Bootstrap 5, jQuery, AJAX
- Tools: .NET User Secrets for secure configuration
BudgetApp/
├── Controllers/ # MVC Controllers (Transactions, Categories, Home)
├── Data/ # EF Core DbContext and database initialization logic
├── Models/ # Domain entities and ViewModels
├── Validations/ # Custom validation attributes (e.g., IdValidation)
├── Views/ # Razor views organized by controller
└── wwwroot/ # Static assets (CSS, JS, Libraries)
├── js/ # Custom JavaScript for AJAX operations
└── css/ # Custom styling
- .NET 10.0 SDK
- SQL Server (LocalDB or Express)
git clone <repository-url>
cd BudgetAppThe application uses SQL Server. You need to provide a connection string named DefaultConnection.
Run the following command in the BudgetApp project directory:
dotnet user-secrets set "ConnectionStrings:DefaultConnection" "Server=(localdb)\\mssqllocaldb;Database=BudgetDB;Trusted_Connection=True;MultipleActiveResultSets=true"Alternatively, edit BudgetApp/appsettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=BudgetDB;Trusted_Connection=True;MultipleActiveResultSets=true"
}
}Navigate to the project directory and run:
cd BudgetApp
dotnet runNote: The application automatically creates and seeds the database on the first run using
context.Database.EnsureCreated().
Open your browser and navigate to:
https://localhost:5001 (or the port specified in the console output)
- Database Initialization: Check
Program.csfor theEnsureCreated()logic which simplifies the initial setup by creating and seeding the database automatically. - Seed Data: Pre-defined categories and sample transactions are configured in
BudgetContext.OnModelCreating. - AJAX Integration: CRUD operations and filtering in
TransactionsControllerreturnPartialViewresults, which are handled bywwwroot/js/transactions.jsto update the DOM without full page reloads. - Custom Validation: See
Validations/IdValidation.csfor a custom attribute used to ensure valid category selection. - Visual Feedback: Categories use color coding defined in the database, reflected in the UI via inline styles.