A comprehensive Library Management System built with ASP.NET Core following Clean Architecture principles and Database First approach.
This project is a RESTful API for managing library operations including book management, user management, and borrowing system with role-based access control.
- Borrowing Limit: Each member can borrow maximum 3 books at a time
- User Roles: System supports Members and Admins with different permissions
- Book Availability: Only available books can be borrowed
- Role Restrictions: Only Admins can manage books, authors, and users
The project follows Clean Architecture pattern with clear separation of concerns:
LibraryManagement/
├── Domain/
├── Application/
├── Infrastructure/
└── API/
- Database First Approach: Schema-driven development using Entity Framework scaffolding
- Clean Architecture: Maintainable and testable code structure
- JWT Authentication: Secure user authentication and authorization
- Role-based Access: Admin and Member roles with different permissions
- Advanced Querying: Search functionality and pagination support
- RESTful API: Standard HTTP methods and status codes
- Framework: ASP.NET Core 8.0
- Database: SQL Server
- ORM: Entity Framework Core (Database First)
- Authentication: JWT (JSON Web Tokens)
- Architecture Pattern: Clean Architecture
- API Style: REST API
The system manages four main entities:
- Author
- Book
- Users
- Borrowing
- Email Validation: Users.Email must match pattern '%@%.%'
- Unique Book-Author: Unique index on (AuthorId, Name) in Books
- Publishing Date: Books cannot have future publishing dates
- Role Validation: Users can only be 'Admin' or 'Member'
spGetUserById
- Get user details by IDspAddUser
- Create new user with role validationspChangePassword
- Update user password securelyspGetAllMembers
- Get paginated users with searchspSearchMembers
- Search users by name or emailspLogin
- User authenticationspCheckEmailExists
- Email existence validation
spGetAllAuthor
- Get authors with optional searchspGetAuthorById
- Get specific authorspCreateAuthor
- Add new authorspUpdateAuthor
- Update author information
spGetBookById
- Get book detailsspGetAllBooks
- Paginated books with search and availability filterspAddBook
- Create book with author validationspUpdateBook
- Update book informationspGetBooksByAuthor
- Get books by specific authorspGetAvailableBooks
- Get only available booksspDeleteBook
- Safe delete (only if not borrowed)spIsBookAvailableForRental
- Check book availability
vw_BooksWithAuthors
- Books joined with author informationvw_AvailableBooks
- Only books available for rental
fn_IsEmailExists
- Check if email already existsfn_IsBookAvailableForRental
- Validate book availability