diff --git a/.vs/CS434.API/DesignTimeBuild/.dtbcache.v2 b/.vs/CS434.API/DesignTimeBuild/.dtbcache.v2 index 9bba224..edf681a 100644 Binary files a/.vs/CS434.API/DesignTimeBuild/.dtbcache.v2 and b/.vs/CS434.API/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/CS434.API/v16/.suo b/.vs/CS434.API/v16/.suo index bcf7baf..998e48c 100644 Binary files a/.vs/CS434.API/v16/.suo and b/.vs/CS434.API/v16/.suo differ diff --git a/.vs/LibraryApplication/v16/.suo b/.vs/LibraryApplication/v16/.suo index 20f1d00..e611135 100644 Binary files a/.vs/LibraryApplication/v16/.suo and b/.vs/LibraryApplication/v16/.suo differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index 95b9050..0c8be5b 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ diff --git a/CS434.API/Controllers/RezervationsController.cs b/CS434.API/Controllers/RezervationsController.cs index dc8aef2..eb3df01 100644 --- a/CS434.API/Controllers/RezervationsController.cs +++ b/CS434.API/Controllers/RezervationsController.cs @@ -38,7 +38,7 @@ public MessageModel returnReservation(ReservationModel reservationModel) return reservationService.returnReservedItem(reservationModel); } - [HttpPost("ShowReservations")] + [HttpGet("ShowReservations")] public ReservationsResponseModel showReservations(int USER_ID) { return reservationService.ShowAllItems(USER_ID); diff --git a/CS434.API/MODELS/Response/ReservationsResponseModel.cs b/CS434.API/MODELS/Response/ReservationsResponseModel.cs index 8f902eb..b6c03a5 100644 --- a/CS434.API/MODELS/Response/ReservationsResponseModel.cs +++ b/CS434.API/MODELS/Response/ReservationsResponseModel.cs @@ -10,6 +10,6 @@ public class ReservationsResponseModel { public bool Result { get; set; } public string Message { get; set; } - public List reservations { get; set; } + public List Items { get; set; } } } diff --git a/CS434.API/Services/ReservationService.cs b/CS434.API/Services/ReservationService.cs index 48baff5..4213d2c 100644 --- a/CS434.API/Services/ReservationService.cs +++ b/CS434.API/Services/ReservationService.cs @@ -123,19 +123,34 @@ public ReservationsResponseModel ShowAllItems(int userId) try { ReservationsResponseModel reservationsResponseModel = new ReservationsResponseModel(); - var queryList = dbContext.Set().ToList(); + var queryList = dbContext.Set().Where(x => x.USER_ID == userId && x.IS_RETURNED == false ).ToList(); + var itemList = dbContext.Set().Where(x => x.Amount > 0).ToList(); + var resultItemList = (from res in queryList + join item in itemList + on res.ITEM_ID equals item.Id + select new Items + { + Id = item.Id, + Name = item.Name, + Type =item.Type, + Author = item.Author, + Year = item.Year, + Amount = item.Amount + }).ToList(); + if (queryList.Count > 0) { + reservationsResponseModel.Message = "All reservations is fetched succesfully!"; reservationsResponseModel.Result = true; - reservationsResponseModel.reservations = queryList; + reservationsResponseModel.Items = resultItemList; return reservationsResponseModel; } else { reservationsResponseModel.Message = "There is no reservations!"; reservationsResponseModel.Result = false; - reservationsResponseModel.reservations = null; + reservationsResponseModel.Items = null; return reservationsResponseModel; } } diff --git a/CS434.API/bin/Debug/netcoreapp2.1/CS434.API.dll b/CS434.API/bin/Debug/netcoreapp2.1/CS434.API.dll index 5500ba2..7694e54 100644 Binary files a/CS434.API/bin/Debug/netcoreapp2.1/CS434.API.dll and b/CS434.API/bin/Debug/netcoreapp2.1/CS434.API.dll differ diff --git a/CS434.API/bin/Debug/netcoreapp2.1/CS434.API.pdb b/CS434.API/bin/Debug/netcoreapp2.1/CS434.API.pdb index 063a3e1..0a057ef 100644 Binary files a/CS434.API/bin/Debug/netcoreapp2.1/CS434.API.pdb and b/CS434.API/bin/Debug/netcoreapp2.1/CS434.API.pdb differ diff --git a/CS434.API/obj/CS434.API.csproj.nuget.dgspec.json b/CS434.API/obj/CS434.API.csproj.nuget.dgspec.json index 2468d1b..2b5fcbe 100644 --- a/CS434.API/obj/CS434.API.csproj.nuget.dgspec.json +++ b/CS434.API/obj/CS434.API.csproj.nuget.dgspec.json @@ -1,17 +1,17 @@ { "format": 1, "restore": { - "C:\\Users\\Cem\\source\\repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj": {} + "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj": {} }, "projects": { - "C:\\Users\\Cem\\source\\repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj": { + "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj": { "version": "1.0.0", "restore": { - "projectUniqueName": "C:\\Users\\Cem\\source\\repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj", + "projectUniqueName": "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj", "projectName": "CS434.API", - "projectPath": "C:\\Users\\Cem\\source\\repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj", + "projectPath": "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj", "packagesPath": "C:\\Users\\Cem\\.nuget\\packages\\", - "outputPath": "C:\\Users\\Cem\\source\\repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\obj\\", + "outputPath": "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\obj\\", "projectStyle": "PackageReference", "configFilePaths": [ "C:\\Users\\Cem\\AppData\\Roaming\\NuGet\\NuGet.Config", diff --git a/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.assets.cache b/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.assets.cache index 9d5f7c5..cae529b 100644 Binary files a/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.assets.cache and b/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.assets.cache differ diff --git a/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.csprojAssemblyReference.cache b/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.csprojAssemblyReference.cache index ba3a390..1b787e9 100644 Binary files a/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.csprojAssemblyReference.cache and b/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.csprojAssemblyReference.cache differ diff --git a/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.dll b/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.dll index 5500ba2..7694e54 100644 Binary files a/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.dll and b/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.dll differ diff --git a/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.pdb b/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.pdb index 063a3e1..0a057ef 100644 Binary files a/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.pdb and b/CS434.API/obj/Debug/netcoreapp2.1/CS434.API.pdb differ diff --git a/CS434.API/obj/project.nuget.cache b/CS434.API/obj/project.nuget.cache index 8f84b2c..9f5219e 100644 --- a/CS434.API/obj/project.nuget.cache +++ b/CS434.API/obj/project.nuget.cache @@ -1,8 +1,8 @@ { "version": 2, - "dgSpecHash": "EnMi58P3Te89eaqmHBleeVu6VSg8Q/d8h3wq0GwVOquKGpKeBgRXhjArZooKDGn4sDofd287ri5e0JKNsDRMJw==", + "dgSpecHash": "z9g8tY/AQkSSHQE6juJ+QGhL7xXHOjCFhoWToWNeOX0D4Dxp2DMfWfrRou9bhdhPlEdzFWGCqynKvJTe4dgN9A==", "success": true, - "projectFilePath": "C:\\Users\\Cem\\source\\repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj", + "projectFilePath": "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj", "expectedPackageFiles": [ "C:\\Users\\Cem\\.nuget\\packages\\microsoft.aspnet.webapi.client\\5.2.6\\microsoft.aspnet.webapi.client.5.2.6.nupkg.sha512", "C:\\Users\\Cem\\.nuget\\packages\\microsoft.aspnetcore\\2.1.1\\microsoft.aspnetcore.2.1.1.nupkg.sha512",