DiscountApp is an ASP.NET Core application that uses SignalR for real-time discount code management. This application allows users to generate and redeem discount codes through a SignalR-based user interface.
Before running the project, ensure you have installed:
- .NET SDK (version 8.0 or higher)
- Entity Framework Core (should be auto-configured during the nuget packages restoring)
- SQLite (should be auto-configured when you setup the database via EF)
-
Clone the repository:
git clone https://github.com/your-username/DiscountApp.git cd DiscountApp -
To run the project you have to:
- Open the project with Visual Studio
- Waiting for the Nuget Package Restore
- Run the migration
dotnet ef database update
- Run the project
Alternatively, you can go into the /DiscountApp folder and run the following commands:
dotnet restore dotnet ef database update dotnet run
- Contexts: Contains the
DiscountContextclass, which configures the database context and tables. - Hubs: Contains the
DiscountHubclass, which handles real-time SignalR connections for generating and using discount codes. - Migrations: Contains database migration files for Entity Framework.
- Models: Defines the
DiscountCodemodel used in the application. - Pages: Contains Razor pages for the front-end of the application.
- Services: Contains the
DiscountService, which provides the business logic for managing discount codes.
- Generate Codes: Allows you to generate a specified number of discount codes with a length of 7 or 8 characters.
- Use Code: Allows you to redeem a discount code, marking it as used in the database.
- The project uses SQLite for simplicity in local development. For production use, consider configuring another database provider.