TheBigStore is a web application that allows users to view, create, edit, and delete products. The application is built using the ASP.NET Core framework and Entity Framework Core. The application uses a SQL Server database to store product data.
Made by Christian C. Høttges
Last updated: 17-04-2024
- Clone the repository to your local machine.
- Open the solution in Visual Studio.
- Update the connection string in the
appsettings.json
file to point to your SQL Server instance. - Open the Package Manager Console and run the following commands:
Add-Migration InitialCreate
Update-Database
- Run the application.
Requirements:
- Visual Studio IDE (recommend Code) to compile.
- Microsoft SQL (recommend Express) to run the database for testing.
Technologies:
- C# (back-end)
- JavaScript
- Html (front-end)
- CSS
- Bootstrap (front-end styling)
- Radzen Blazor (styling)
- SQL (data storage)
- ASP.NET Core (framework)
- Entity Framework Core (data access)
- Identity (user management)
- Roles (role-based access control)
- Logging (error handling)
- Session (user session management)
- AutoMapper (object-object mapping)
- Front-end: Allows users to view, create, edit, and delete products and use all the frontend features of the application thru it.
- Back-end: Allows users can use all the features of the application thru the repository and services.
- Repository pattern: Allows users to use the repository pattern to get data from the database.
- Service pattern: Allows users to use the service pattern to get data from the repository.
- Database: Uses a SQL Server database to store product data.
- Unit Testing: Includes comprehensive unit testing for various components of the application.
- Dependency Injection: Utilizes dependency injection for improved modularity and abstraction.
- Logging: Implements logging for better error handling and debugging.
- Security: Includes role management features for role-based access control.
- User Account Management: Enhanced user account creation process with default roles and error handling.
- Database Migration: Implements a new database migration to establish the initial database schema.
- DTO Integration: Introduces DTO classes for multiple entities, facilitating data transfer and abstraction between layers.
- Asynchronous Operations: Modifies the
GetById
method in various interfaces and classes to be asynchronous, enhancing performance and responsiveness.
Version 2.2.2 (03/05/2024 - Current version) Major Changes and Refactoring
- Blazor Application: A new Blazor project,
TheBigStore.Blazor
, was added to the solution. This project includes pages for Home, Counter, and Weather, along with a navigation menu and main layout. This marks a significant addition to the solution, introducing Blazor as a new framework. - Solution File Modification: The solution file
TheBigStore.sln
was updated to include the new Blazor project, indicating a broader scope for the solution. The project type forTheBigStore.WebAPI
was also changed. - Launch Settings and Icons: Updated the
launchSettings.json
file with new configurations for launching the Blazor application. Additionally, updatedfavicon.png
, and added new icon files (icon-192.png
,icon-512.png
) and a web manifest file (manifest.webmanifest
), providing additional resources for the application. - Blazor Project Configuration: The
Program.cs
file was updated to initialize the Blazor WebAssembly host and set up various services, includingHttpClient
. This change indicates a shift towards Blazor and enhances dependency injection support. - New Components and Services: Added new components such as
MainLayout.razor
,NavMenu.razor
, andApp.razor
, structuring the Blazor application. Theservice-worker.js
file was added to provide offline support through service workers. - Additional Refactoring and Cleanup: Removed obsolete files, updated existing components to align with the new Blazor structure, and deleted unused methods and properties to streamline the codebase.
Code Refactoring and Database Updates
- Data Type Refactoring: Updated data types from
ObservableCollection
toList
in various.cshtml.cs
files to improve performance and reduce overhead. - Asynchronous Operations: Replaced synchronous
GetById
methods with asynchronousGetByIdAsync
, improving application responsiveness. - Database Update Operations: Updated how entities are updated in the database by directly passing the updated entity to the
UpdateAsync
method. - Package Additions: Added
Newtonsoft.Json
andMicrosoft.AspNetCore.Mvc.NewtonsoftJson
toTheBigStore.Application.csproj
for improved JSON serialization and deserialization. - Repository Updates: Updated
IGenericRepository
to include methods for adding and updating lists of entities. Updated several repository files to support CRUD operations and reflect changes in the database schema. - DTO and Entity Property Updates: Added new properties and navigation properties to
Customer
,Image
,ItemOrder
, andUser
classes to enhance relationships between entities. - Service Layer Enhancements: Updated
IGenericService.cs
andGenericService.cs
with new methods for creating and updating lists of entities. - Controller Updates: Updated various controller files to use more RESTful conventions and refactored
Checkout.cshtml.cs
to improve item quantity handling in the cart. - Database Schema Changes: Implemented a new migration
FixedVersion
to update the database schema and maintain consistency with the refactored entity models.
Version 2.1.1 (17/04/2024 - Current version) Code Files and Database Structure Updates
- The code files related to the checkout process, item search, and customer and item services have been updated to reflect these changes. The checkout form now includes fields for first name, last name, phone number, street name, street number, city, country, and zip code. The
AddToCart
method has been moved from the item services to the customer services. AQuantity
property has been added to theItem
andItemDto
classes. - The database schema has been updated to include a
Quantity
field in theProducts
table. A new migration has been added to implement this change.
Overall Changes
- Redesigned Checkout Form and Shopping Cart Display: The checkout form and shopping cart display have been significantly redesigned for improved user experience.
- Updated Code Files: Several code files have been updated to reflect the changes in the checkout process, item search, and customer and item services.
- Database Structure Updates: The database schema has been updated to include a
Quantity
field in theProducts
table.
File Changes
- Checkout.cshtml.cs: Added new properties for handling checkout form inputs and a new method for handling form submission. Updated the
OnGet
method to retrieve cart items from the session. Added new methods for increasing and decreasing item quantity and removing items from the cart. - Products.cshtml: Removed old layout and added a new one with enhanced user authorization check, item display, and pagination form. Added an alert message for no items found.
- Login.cshtml.cs: Corrected the form's
asp-page-handler
attribute value from "login" to "Login". Added logic to clear the cart on login with a different user ID. - Logout.cshtml.cs: Updated to store the user's last ID in the session before removing the current ID.
- _Layout.cshtml: Added a search form and updated the cart link's href attribute.
- SessionHelper.cs: Added new extension methods for setting and getting complex objects in the session using JSON serialization.
Version 2.0.0 (11/04/2024)
- Namespace Refactoring:
- Organized namespaces for better code organization, enhancing readability and maintainability.
- Dependency Injection and Logging:
- Added the
Microsoft.Extensions.Options
namespace and a staticCreate
method toTheBigStoreContext.cs
, enabling configuration options and simplified context creation. - Integrated
Autofac
for dependency injection andAutoMapper
for object-object mapping, improving modularity and abstraction.
- Added the
- Asynchronous Operations:
- Modified the
GetById
method in various interfaces and classes to be asynchronous, enhancing performance and responsiveness.
- Modified the
- Database Structure:
- Implemented significant changes to the database structure, including the addition of new models for entities and seed data, enhancing data integrity and consistency.
- Unit Testing:
- Added comprehensive unit testing, including creation of new unit test files and removal of redundant test classes, ensuring robustness and reliability.
- DTO Integration:
- Introduced DTO classes for multiple entities, facilitating data transfer and abstraction between layers.
- Service Layer Enhancements:
- Added new service classes and interfaces, improving encapsulation and separation of concerns.
- Role Management:
- Introduced role management features, enabling role-based access control and enhancing security.
- Updated user session management to store user ID and role, improving authentication and authorization mechanisms.
- User Account Management:
- Enhanced user account creation process, setting default roles and implementing error handling for user creation.
- Removal of Redundant Code:
- Removed unnecessary files, methods, and dependencies, streamlining the codebase and reducing complexity.
- Database Migration:
- Implemented a new database migration to establish the initial database schema, ensuring database consistency and compatibility.
Version 1.0.0 (02/04/2024)
- Updated
TheBigStoreContext
class and various model classes. - Removed the
DbContextOptions<TheBigStoreContext>
parameter from the constructor. - Added new
DbSet
properties for entities toTheBigStoreContext
. - Updated the
OnModelCreating
method to define relationships and seed data. - Updated model classes with new properties and navigation properties.
- Updated
Program
andUnitTheBigStoreContext
classes. - Removed the connection string for the SQL Server database from
UnitTheBigStoreContext
.
Version 0.0.5 (02/04/2024)
- Added new model classes for various entities.
- Updated
TheBigStoreContext
withDbSet
properties for the new models. - Overrode the
OnModelCreating
method inTheBigStoreContext
. - Created a new instance of
TheBigStoreContext
inProgram.cs
. - Added a new enum for order statuses.
- Removed the folder include for "Models" from
TheBigStore.Repository.csproj
.
Version 0.0.4 (01/04/2024)
- Added
Microsoft.Extensions.DependencyInjection
andMicrosoft.Extensions.Logging
namespaces. - Modified the connection string and included
EnableSensitiveDataLogging
method inTheBigStoreContext
. - Created a new
ILoggerFactory
instance in theOnConfiguring
method.
Version 0.0.3 (01/04/2024)
- Added a new unit testing project named
TheBigStore.UnitTesting
. - Included configurations for unit testing in the solution file.
- Added package references for
coverlet.collector
,Microsoft.NET.Test.Sdk
,xunit
, andxunit.runner.visualstudio
. - Added project references to
TheBigStore.Repository
andTheBigStore.Service
. - Introduced five new unit test files.
- Added a utility class for unit testing.
- Implemented a new method in the
TheBigStoreContext
class.
Version 0.0.2 (30/03/2024)
- Added the structure of the application.
- Added the repository and service pattern.
- Added the database connection.
Version 0.0.1 (30/03/2024)
- Initial pre-release of The Big Store Application.
- Features include Backend templete.
- Stucture of the application.
- Checkout Form and Shopping Cart - v2.1.1
- Comprehensive Update and Refinement - v2.0.0
- Testing and Database Structure - v1.0.0
- Repo and service pattern - v0.0.2
- Structure - v0.0.1
We are constantly working to improve this application. If you encounter any bugs or errors, please report them to us.
Phone number: +45 28 78 34 14
Email: GuttiDK@gmail.com
This project is licensed under the MIT license. See the LICENSE
file for further details.