WebAPI for CRUD operations of library client app built with C# ASP.NET (.NET Framework 4.8). This API interacts with library's database via Entity Framework.
API | Description |
---|---|
GET api/Books | Gets list of Books from the server |
GET api/Books/{id} | Gets the book by Id from the server |
POST api/Books | Adds the book to the server |
DELETE api/Books/{id} | Deletes the book by Id |
PUT api/Books | Updates the book data on the server |
API | Description |
---|---|
GET api/Users | Gets list of users from the server |
GET api/Users/{id} | Gets the user by Id |
POST api/Users | Adds user to the server |
DELETE api/Users/{id} | Deletes user by Id |
PUT api/Users | Updates user's data |
API | Description |
---|---|
GET api/UserBooks | Gets list of records (books that were taken by users) from the server |
POST api/UserBooks | Adds user-book record to the server |
PUT api/UserBooks | Updates user-book record |
DELETE api/UserBooks/{id} | Deletes user-book record by id |
Database file is in Database/ folder.
It has 3 tables:
- Users
CREATE TABLE [dbo].[Users] ( [Id] INT IDENTITY (1, 1) NOT NULL, [FullName] NVARCHAR (50) NOT NULL, [DateOfBirth] DATE NULL, [Address] NVARCHAR (255) NULL, [Email] NVARCHAR (255) NOT NULL, [Phone] NVARCHAR (20) NULL, PRIMARY KEY CLUSTERED ([Id] ASC) );
- Books
CREATE TABLE [dbo].[Books] ( [Id] INT IDENTITY (1, 1) NOT NULL, [Name] NVARCHAR (255) NOT NULL, [Author] NVARCHAR (255) NOT NULL, [Description] NVARCHAR (MAX) NULL, [PrintDate] DATE NULL, [Quantity] INT NULL, PRIMARY KEY CLUSTERED ([Id] ASC) );
- UserBooks -
CREATE TABLE [dbo].[UserBooks] ( [UserBookID] INT IDENTITY (1, 1) NOT NULL, [UserID] INT NOT NULL, [BookID] INT NOT NULL, [CheckoutDate] DATE NULL, [ReturnDate] DATE NULL, PRIMARY KEY CLUSTERED ([UserBookID] ASC), FOREIGN KEY ([UserID]) REFERENCES [dbo].[Users] ([Id]), FOREIGN KEY ([BookID]) REFERENCES [dbo].[Books] ([Id]) );