Development of a Library Management System using ASP.NET Core Identity and Entity Framework
This project implements a Library Management System that supports essential functionalities such as:
- CRUD operations (Create, Read, Update, Delete)
- User authentication and authorization
- Layouts with ViewBag/ViewData
- Tag helpers, forms, and validation
The system allows students to register and log in, while librarians can only log in (not register). Both roles share some features, while others are role-specific.
The application consists of:
- 3 Controllers
- 17 Views (including default views)
- ASP.NET Core Identity โ User authentication & role management
- Entity Framework Core โ Data access
- ASP.NET MVC โ Web interface
- SQLite โ Database storage
- Students can register and log in.
- Librarians can only log in (registration not available).
- Role-based access control is managed using ASP.NET Core Identity.
- Additional properties for student accounts
- Borrow and return books
- Leave and list reviews
- View all books and categorized book lists
- Additional properties for librarian accounts
- Full CRUD operations:
- Add books, genres, authors, and categories
- Update and delete books
- Search for books
- View book lists
- Access user info
- List and view reviews
Userentity inherits from IdentityUserStudentandLibrarianinherit fromUser
Models Implemented:
- User
- Student
- Librarian
- Author
- Category
- Genre
- Review
- HomeController โ Directs to Account and Dashboard
- AccountController โ Handles login & registration
- DashboardController โ Main functionality for the application
- Multiple seed data files created to populate the database in advance
- Views implemented for almost all actions
During development, several issues were encountered and resolved, including:
SQLite Error 19: UNIQUE constraint failed: AspNetUsers.NormalizedUserNameUnable to track an entity of type 'User' because its primary key property 'Id' is nullFOREIGN KEY constraint failedThe model item passed into the ViewDataDictionary is of type 'Book', but requires IEnumerable<Book>System.NullReferenceException: Object reference not set to an instance of an object- Request matching multiple endpoints
- Validation issues (e.g., "Student field is required")
This project successfully demonstrates the development of a Library Management System using ASP.NET Core Identity.
Key concepts implemented:
- Role-based access control
- Custom user attributes
- Integration with a relational database
- Introduce additional roles
- Enhance UI/UX design
- Add a notification system
- Advanced analytics (e.g., student borrowing patterns)
- YouTube tutorials on ASP.NET Core Identity
- StackOverflow discussions
- ChatGPT assistance
- Course documents from the professor