test
test01 # Material Management Application
A comprehensive ASP.NET Core 8.0 MVC application for managing materials and categories with user authentication and role-based authorization.
- User Authentication: ASP.NET Core Identity with registration and login
- Role-Based Authorization: Admin, Manager, and User roles
- CRUD Operations: Full Create, Read, Update, Delete functionality
- Entity Framework Core: Code-first approach with migrations
- Responsive Design: Bootstrap-based UI
- Docker Support: Multi-stage Dockerfile for containerization
- Database Seeding: Automatic role and admin user creation
- Framework: ASP.NET Core 8.0 MVC
- Database: Entity Framework Core with SQL Server
- Authentication: ASP.NET Core Identity
- Frontend: Razor Views, Bootstrap 5
- Containerization: Docker
- Version Control: Git
- .NET 8.0 SDK
- SQL Server or SQLite (for cross-platform)
- Docker (optional)
- Git
git clone https://github.com/informatixs/materialmanagementapp.git
cd materialmanagementappUpdate the connection string in appsettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=MaterialManagementDB;Trusted_Connection=True;"
}
}For SQLite (cross-platform):
{
"ConnectionStrings": {
"DefaultConnection": "Data Source=MaterialManagement.db"
}
}dotnet ef database updatedotnet runNavigate to: https://localhost:5001
After running the application for the first time:
- Email: admin@materialmanagement.com
- Password: Admin@123
MaterialManagement/
├── Controllers/
│ ├── CategoriesController.cs
│ ├── HomeController.cs
│ └── MaterialsController.cs
├── Data/
│ ├── ApplicationDbContext.cs
│ └── SeedData.cs
├── Models/
│ ├── Category.cs
│ └── Material.cs
├── Views/
│ ├── Categories/
│ ├── Materials/
│ ├── Home/
│ └── Shared/
├── wwwroot/
│ ├── css/
│ ├── js/
│ └── lib/
├── appsettings.json
├── Program.cs
├── Dockerfile
└── .gitignore
docker build -t materialmanagement .docker run -p 8080:8080 -p 8081:8081 materialmanagementAccess the app at: http://localhost:8080
- CategoryId (PK)
- Name
- Description
- MaterialId (PK)
- Name
- Description
- Price
- Quantity
- CategoryId (FK)
- One Category can have many Materials (One-to-Many)
# Create a new migration
dotnet ef migrations add MigrationName
# Update database
dotnet ef database update
# Remove last migration
dotnet ef migrations remove
# Drop database
dotnet ef database drop# Standard run
dotnet run
# With hot reload
dotnet watch run
# Specific environment
dotnet run --environment Production# Build project
dotnet build
# Publish for deployment
dotnet publish -c Release -o ./publish-
Create a new feature branch
git checkout -b feature/your-feature-name
-
Make changes and test
dotnet watch run
-
Commit changes
git add . git commit -m "Add feature: description"
-
Push to GitHub
git push origin feature/your-feature-name
-
Create Pull Request on GitHub
For a detailed step-by-step tutorial on building this application from scratch, see TUTORIAL.md
- ASP.NET Core MVC fundamentals
- Entity Framework Core with Code First
- Identity framework implementation
- CRUD operations
- Database relationships
- Docker containerization
- Git version control
Solution: Switch to SQLite
-
Remove SQL Server package:
dotnet remove package Microsoft.EntityFrameworkCore.SqlServer
-
Add SQLite package:
dotnet add package Microsoft.EntityFrameworkCore.Sqlite
-
Update
Program.cs:options.UseSqlite(connectionString)
Solution: Change port
dotnet run --urls "http://localhost:5005"Solution: Reset migrations
dotnet ef database drop
dotnet ef migrations remove
dotnet ef migrations add InitialCreate
dotnet ef database update- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed for educational purposes.
- Tutorial created for ASP.NET Core training
- ASP.NET Core Team
- Entity Framework Core Team
- Bootstrap Team
For issues and questions:
- Check TUTORIAL.md for detailed instructions
- Review ASP.NET Core documentation
- Open an issue in the GitHub repository
Happy Coding! 🚀