Skinet is an e-commerce web application built using ASP.NET Core and Entity Framework Core. The application provides a platform for users to browse and purchase products, while administrators can manage the product catalog. The project follows a clean architecture pattern, leveraging dependency injection, repository pattern, and specification pattern to ensure a maintainable and scalable codebase.
- Product Catalog: Users can browse a catalog of products, view product details, and filter products by brand and type.
- Product Management: Administrators can add, update, and delete products, brands, and types.
- Error Handling: Custom middleware for handling exceptions and returning appropriate error responses.
- Swagger Integration: API documentation and testing using Swagger UI.
- CORS Support: Configured CORS policy to allow cross-origin requests.
- Static Files: Serving static files such as images, CSS, and JavaScript.
- Database Seeding: Initial seeding of the database with sample data for products, brands, and types.
- ASP.NET Core: For building the web API.
- Entity Framework Core: For data access and database management.
- AutoMapper: For object-object mapping.
- Swagger: For API documentation and testing.
- SQLite: As the database provider.
- Dependency Injection: For managing dependencies and promoting loose coupling.
- Repository Pattern: For abstracting data access logic.
- Specification Pattern: For encapsulating query logic.
- API: Contains the controllers, DTOs, and middleware.
- Core: Contains the domain entities, interfaces, and specifications.
- Infrastructure: Contains the data access logic, including the DbContext and repository implementations.
- Clone the repository:
git clone https://github.com/your-repo/skinet.git
- Navigate to the project directory:
cd skinet
- Install dependencies:
dotnet restore
- Apply database migrations:
dotnet ef database update
- Run the application:
dotnet run
- Access the Swagger UI at
http://localhost:5000/swagger
to explore and test the API endpoints. - Use the provided endpoints to manage products, brands, and types.
- Program.cs: Configures the application, services, and middleware.
- StoreContext.cs: The Entity Framework Core DbContext for the application.
- ProductsController.cs: The controller for managing products.
- StoreContextSeed.cs: Seeds the database with initial data.
- SpecificationEvaluator.cs: Applies specifications to queries.
-
Create a new Web API project:
dotnet new webapi -n MyProject --use-controllers
-
Add project to solution:
dotnet sln add MyProject
-
Check if project is added to solution:
dotnet sln list
-
Create class library projects:
dotnet new classlib -n MyProject.Core dotnet new classlib -n MyProject.Infrastructure
-
Add project references:
dotnet add reference ../MyProject
-
Restore project dependencies:
dotnet restore
-
Add a migration:
dotnet ef migrations add InitialCreate -o Data/Migrations
-
Update the database:
dotnet ef database update
-
Drop the database:
dotnet ef database drop -p Infrastructure -s MyProject
-
Remove the last migration:
dotnet ef migrations remove -p Infrastructure -s MyProject
-
Add a new migration:
dotnet ef migrations add InitialCreate -p Infrastructure -s API -o Data/Migrations
-
Run the application with hot reload:
dotnet watch run
-
Create a .gitignore file:
dotnet new gitignore
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License.
create agurlar project ng new client
creat a new component ng g c shop
create a new module ng g m shop ng g c --flat --skip-tests shop/shop // --flat to not create a folder for the component
you can use --dry-run to see what will be created without actually creating it.
create service ng g s shop/shop
ng g m core --dry-run