Skip to content

Commit

Permalink
new code for reservations in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Aneliya05 committed Mar 10, 2024
1 parent 3c641f3 commit 33f98d1
Show file tree
Hide file tree
Showing 50 changed files with 81 additions and 35 deletions.
Binary file modified YourPlace/.vs/ProjectEvaluation/yourplace.metadata.v7.bin
Binary file not shown.
Binary file modified YourPlace/.vs/ProjectEvaluation/yourplace.projects.v7.bin
Binary file not shown.
Binary file modified YourPlace/.vs/YourPlace/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file modified YourPlace/.vs/YourPlace/v17/.futdcache.v2
Binary file not shown.
Binary file modified YourPlace/.vs/YourPlace/v17/.suo
Binary file not shown.
22 changes: 15 additions & 7 deletions YourPlace/ConsoleApp1/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@
#endregion
//FIRST METHOD TESTED: WORKS
#region Rooms seeding
RoomServices roomServices = new RoomServices(dbContext);
decimal price = 250;
int count = 4;
int hotelId = 8;
int count1 = 9;
Room room = new Room(RoomTypes.maisonette, price, count, hotelId, count1);
await roomServices.CreateAsync(room);
RoomServices roomServices = new RoomServices(dbContext, hotelsServices);
//decimal price = 250;
//int count = 4;
//int hotelId = 8;
//int count1 = 9;
//Room room = new Room(RoomTypes.maisonette, price, count, hotelId, count1);
//await roomServices.CreateAsync(room);
//await roomAvailabilityServices.FillAvailability(9);
#endregion

Expand Down Expand Up @@ -222,4 +222,12 @@
//{
// Console.WriteLine(room.ToString());
//}
#endregion

#region testing
List<Room> roomList = await roomServices.GetAllRoomsInHotel(9);
foreach(Room room1 in roomList)
{
Console.WriteLine(room1.ToString());
}
#endregion
Binary file modified YourPlace/ConsoleApp1/bin/Debug/net8.0/SeedingLayer.dll
Binary file not shown.
Binary file modified YourPlace/ConsoleApp1/bin/Debug/net8.0/SeedingLayer.exe
Binary file not shown.
Binary file modified YourPlace/ConsoleApp1/bin/Debug/net8.0/SeedingLayer.pdb
Binary file not shown.
Binary file modified YourPlace/ConsoleApp1/bin/Debug/net8.0/YourPlace.Core.dll
Binary file not shown.
Binary file modified YourPlace/ConsoleApp1/bin/Debug/net8.0/YourPlace.Core.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("SeedingLayer")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3c641f32d9dd69987a2c645e25feea836e3ac56b")]
[assembly: System.Reflection.AssemblyProductAttribute("SeedingLayer")]
[assembly: System.Reflection.AssemblyTitleAttribute("SeedingLayer")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
28e1721bd7aac5dfd6d8b628ddd0de008a6504d0e3158557fb2c3352295340d1
263ce86f51d721700ea299012eb89160a4a6c70bf334c12908ca72b594b0170d
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c6861c9b26ea2d293ba9c03af67b51500204d1da4d9c4614ac92993ad5774ce8
5ed42eec64114513b3acefd3e1f5f7e43a85b69b7954e8c78241b3df97d9f015
Binary file modified YourPlace/ConsoleApp1/obj/Debug/net8.0/SeedingLayer.dll
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
52112f0f1eeb456697b8665fb7c5b8fc3ee0c71870126f8b4c1ec265e3830571
00f1d0e1483331ee1591b9c8eb288948b4fa23a7b27da9036e021dc281b4f3b4
Binary file modified YourPlace/ConsoleApp1/obj/Debug/net8.0/SeedingLayer.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documents":{"C:\\Users\\aneli\\*":"https://raw.githubusercontent.com/Aneliya05/School/66cd35a09e7a6037ed0c1cd00f6981d2c4925656/*"}}
{"documents":{"D:\\Aneliya\\My Projects\\TeamTravellers\\YourPlace\\*":"https://raw.githubusercontent.com/TeamTravellers/YourPlace/3c641f32d9dd69987a2c645e25feea836e3ac56b/*"}}
Binary file modified YourPlace/ConsoleApp1/obj/Debug/net8.0/apphost.exe
Binary file not shown.
Binary file modified YourPlace/ConsoleApp1/obj/Debug/net8.0/ref/SeedingLayer.dll
Binary file not shown.
Binary file modified YourPlace/ConsoleApp1/obj/Debug/net8.0/refint/SeedingLayer.dll
Binary file not shown.
51 changes: 35 additions & 16 deletions YourPlace/YourPlace.Core/Services/ReservationServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task<Reservation> ReadAsync(int key, bool useNavigationalProperties
{
reservations.AsNoTrackingWithIdentityResolution();
}
return await reservations.SingleOrDefaultAsync(x => x.HotelID == key);
return await reservations.SingleOrDefaultAsync(x => x.ReservationID == key);
}
catch (Exception)
{
Expand All @@ -82,7 +82,7 @@ public async Task<List<Reservation>> ReadAllAsync(bool useNavigationalProperties
throw;
}
}

public async Task UpdateAsync(Reservation item)
{
try
Expand Down Expand Up @@ -114,23 +114,11 @@ public async Task DeleteAsync(int key)
throw;
}
}
public async Task<List<Reservation>> FindReservationsForHotel(int hotelID)
{
try
{
List<Reservation> reservations = await ReadAllAsync();
List<Reservation> reservationsForHotel = reservations.Where(x => x.HotelID == hotelID).ToList();
return reservationsForHotel;
}
catch
{
throw;
}
}

#endregion



#region old code
public async Task<bool> CompareTotalCountWithFamilyMembersCount(List<Family> families, int totalCount) //something like js function
{
try
Expand Down Expand Up @@ -427,5 +415,36 @@ public async Task<bool> CompleteReservation(string firstName, string surname, Da
}
return success;
}
#endregion

#region new code in progress
public async Task<List<Reservation>> FindReservationsForHotel(int hotelID)
{
try
{
List<Reservation> reservations = await ReadAllAsync();
List<Reservation> reservationsForHotel = reservations.Where(x => x.HotelID == hotelID).ToList();
return reservationsForHotel;
}
catch
{
throw;
}
}

//GETALLROOMSINHOTEL();
//public async Task<List<Room>> FreeRoomsCheck(int hotelID, DateOnly arrivalDate, DateOnly leavingDate)
//{
// List<Reservation> reservationsForHotel = await FindReservationsForHotel(hotelID);
// foreach(Reservation reservation in reservationsForHotel)
// {
// if(leavingDate < reservation.ArrivalDate || arrivalDate > reservation.LeavingDate)
// {

// }
// }
//}
#endregion
}
}

21 changes: 20 additions & 1 deletion YourPlace/YourPlace.Core/Services/RoomServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ namespace YourPlace.Core.Services
public class RoomServices : IDbCRUD<Room, int>
{
private readonly YourPlaceDbContext _dbContext;
public RoomServices(YourPlaceDbContext dbContext)
private readonly HotelsServices _hotelsServices;
public RoomServices(YourPlaceDbContext dbContext, HotelsServices hotelsServices)
{
_dbContext = dbContext;
_hotelsServices = hotelsServices;
}
#region CRUD For Rooms
public async Task CreateAsync(Room room)
Expand Down Expand Up @@ -104,5 +106,22 @@ public async Task DeleteAsync(int key)
}
}
#endregion

public async Task<List<Room>> GetAllRoomsInHotel(int hotelID)
{
Hotel hotel = await _hotelsServices.ReadAsync(hotelID);
List<Room> roomList = await ReadAllAsync();
List<Room> roomsInHotel = new List<Room>();

foreach(Room room in roomList)
{
if(room.HotelID == hotelID)
{
roomsInHotel.Add(room);
}
}
return roomsInHotel;

}
}
}
Binary file modified YourPlace/YourPlace.Core/bin/Debug/net8.0/YourPlace.Core.dll
Binary file not shown.
Binary file modified YourPlace/YourPlace.Core/bin/Debug/net8.0/YourPlace.Core.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("YourPlace.Core")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c9daeece661a43dbb19d9d4c557aac9a8ce86ea7")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3c641f32d9dd69987a2c645e25feea836e3ac56b")]
[assembly: System.Reflection.AssemblyProductAttribute("YourPlace.Core")]
[assembly: System.Reflection.AssemblyTitleAttribute("YourPlace.Core")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
728d03bf6903890855fccbf6153c5d47af8711b2d38e44be837db476d42b44c6
01cc7bba4ea32a3e7cdefdff68265d97a783a6f4a099de2674e5581f09237c8c
Binary file modified YourPlace/YourPlace.Core/obj/Debug/net8.0/YourPlace.Core.dll
Binary file not shown.
Binary file modified YourPlace/YourPlace.Core/obj/Debug/net8.0/YourPlace.Core.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documents":{"D:\\Aneliya\\My Projects\\TeamTravellers\\YourPlace\\*":"https://raw.githubusercontent.com/TeamTravellers/YourPlace/c9daeece661a43dbb19d9d4c557aac9a8ce86ea7/*"}}
{"documents":{"D:\\Aneliya\\My Projects\\TeamTravellers\\YourPlace\\*":"https://raw.githubusercontent.com/TeamTravellers/YourPlace/3c641f32d9dd69987a2c645e25feea836e3ac56b/*"}}
Binary file modified YourPlace/YourPlace.Core/obj/Debug/net8.0/ref/YourPlace.Core.dll
Binary file not shown.
Binary file modified YourPlace/YourPlace.Core/obj/Debug/net8.0/refint/YourPlace.Core.dll
Binary file not shown.
Binary file modified YourPlace/YourPlace/bin/Debug/net8.0/YourPlace.Core.dll
Binary file not shown.
Binary file modified YourPlace/YourPlace/bin/Debug/net8.0/YourPlace.Core.pdb
Binary file not shown.
Binary file modified YourPlace/YourPlace/bin/Debug/net8.0/YourPlace.dll
Binary file not shown.
Binary file modified YourPlace/YourPlace/bin/Debug/net8.0/YourPlace.exe
Binary file not shown.
Binary file modified YourPlace/YourPlace/bin/Debug/net8.0/YourPlace.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("YourPlace")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c9daeece661a43dbb19d9d4c557aac9a8ce86ea7")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3c641f32d9dd69987a2c645e25feea836e3ac56b")]
[assembly: System.Reflection.AssemblyProductAttribute("YourPlace")]
[assembly: System.Reflection.AssemblyTitleAttribute("YourPlace")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
07fc60030e4e2b41d39cd12e89c86a2d72de5be6254d1f063151740522d4df59
07e41dea588c3e04ccf998728e02b06115ebd9f4b7f637e85d3b73a17b3cf143
Binary file not shown.
Binary file modified YourPlace/YourPlace/obj/Debug/net8.0/YourPlace.dll
Binary file not shown.
Binary file modified YourPlace/YourPlace/obj/Debug/net8.0/YourPlace.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documents":{"D:\\Aneliya\\My Projects\\TeamTravellers\\YourPlace\\*":"https://raw.githubusercontent.com/TeamTravellers/YourPlace/c9daeece661a43dbb19d9d4c557aac9a8ce86ea7/*"}}
{"documents":{"D:\\Aneliya\\My Projects\\TeamTravellers\\YourPlace\\*":"https://raw.githubusercontent.com/TeamTravellers/YourPlace/3c641f32d9dd69987a2c645e25feea836e3ac56b/*"}}
Binary file modified YourPlace/YourPlace/obj/Debug/net8.0/apphost.exe
Binary file not shown.
Binary file modified YourPlace/YourPlace/obj/Debug/net8.0/ref/YourPlace.dll
Binary file not shown.
Binary file modified YourPlace/YourPlace/obj/Debug/net8.0/refint/YourPlace.dll
Binary file not shown.

0 comments on commit 33f98d1

Please sign in to comment.