/// <summary> /// Instantiates a new HotelsController object. /// </summary> /// <param name="hotel"> /// IHotel: a repository object that implements the IHotel interface /// </param> public HotelsController(IHotel hotel, IHotelRoom hotelRoom, IRoom room, IAmenity amenity) { _hotel = hotel; _hotelRoom = hotelRoom; _room = room; _amenity = amenity; }
public async Task <HotelDTO> GetHotelByName(string hotelName, IHotelRoom hotelRoom, IRoom room, IAmenity amenity) { int hotelId = await _context.Hotels .Where(x => x.Name == hotelName) .Select(x => x.Id) .FirstAsync(); return(await GetHotel(hotelId, hotelRoom, room, amenity)); }
public void RoomEventFinder(HotelNode GoToNode, HotelEvent evt) { if (evt.EventType.Equals(HotelEventType.CHECK_OUT) || evt.EventType.Equals(HotelEventType.EVACUATE)) // Checks if this events has to leave the hotel and make the rooms not full. { hotelRoom.Occupied = false; leaveHotel = true; MyRoom.hotelNode.BackgroundImage = Image.FromFile(@"..\..\Resources\Images\Room.png"); } hotelRoomDestination = (IHotelRoom)GoToNode.HotelObject; specificRoomDirections = RoomPathFinder.PathToRoom(hotelNode, GoToNode, hotelNodes); // Uses Dijkstra to find the shortest path to a room. (Location of Human, location of destination, hotel graph) }
public DBTestBase() { _connection = new SqliteConnection("Filename=:memory:"); _connection.Open(); _db = new AsyncInnDbContext( new DbContextOptionsBuilder <AsyncInnDbContext>() .UseSqlite(_connection) .Options); _db.Database.EnsureCreated(); _hotel = new HotelRepo(_db, _hotelRoom); _hotelRoom = new HotelRoomRepo(_db, _room); _room = new RoomRepo(_db, _amenities); _amenities = new AmenitiesRepo(_db); }
public async Task <HotelDTO> GetHotel(int id, IHotelRoom hotelRoom, IRoom room, IAmenity amenity) { HotelDTO hotelDTO = await _context.Hotels .Where(x => x.Id == id) .Select(x => new HotelDTO { Id = x.Id, Name = x.Name, StreetAddress = x.StreetAddress, City = x.City, State = x.State, Phone = x.Phone }) .FirstAsync(); hotelDTO.Rooms = await hotelRoom.GetHotelRoomsForHotel(id, room, amenity); return(hotelDTO); }
public void Move() { if (leaveHotel == true && hotelRoom == hotelRoomDestination) { hotelRoom.RemoveHuman(this); if (hotelRoom.HumanList.Count == 0) { hotelNode.Image = null; } } if (specificRoomDirections.Count > 0) { HotelNode NextHotelNode = specificRoomDirections.FirstOrDefault(n => hotelNode.RoomNeighbour.Any(e => e.RoomDestination == n)); // Finds the neighbouring hotelnode that equals the first HotelNode in the specificRoomDirections List. hotelRoom.RemoveHuman(this); if (hotelRoom.HumanList.Any(h => h is Guest)) { hotelNode.Image = Image.FromFile(@"..\..\Resources\Images\Guest.png"); } else { hotelNode.Image = Image.FromFile(@"..\..\Resources\Images\Cleaner.png"); } if (hotelRoom.HumanList.Count == 0) // Checks if this hotelRooms HumanList has any humans in it. { hotelNode.Image = null; // Sets this hotelNodes image to null. } hotelRoom = (IHotelRoom)NextHotelNode.HotelObject; // Casts the NextHotelNodes object to this humans hotelRoom. hotelRoom.AddHuman(this); NextHotelNode.Image = Sprite; if (hotelRoom.HumanList.Any(h => h is Guest) && hotelRoom.HumanList.Any(h => h is Cleaner)) { NextHotelNode.Image = Image.FromFile(@"..\..\Resources\Images\CombinedCleanerGuest.png"); } specificRoomDirections.Remove(NextHotelNode); // Removes the NextHotelNode from the specificRoomDirections list so next move instructions will be of the next HotelNode in the list. hotelNode = NextHotelNode; } else { hotelNode.Image = null; // When Cleaner reached Destination image disapears as if going into their room. } }
public async Task <List <HotelDTO> > GetHotels(IHotelRoom hotelRoom, IRoom room, IAmenity amenity) { List <HotelDTO> hotelDTOs = await _context.Hotels .Select(x => new HotelDTO { Id = x.Id, Name = x.Name, StreetAddress = x.StreetAddress, City = x.City, State = x.State, Phone = x.Phone }) .ToListAsync(); foreach (HotelDTO oneHotelDTO in hotelDTOs) { oneHotelDTO.Rooms = await hotelRoom.GetHotelRoomsForHotel(oneHotelDTO.Id, room, amenity); } return(hotelDTOs); }
public HotelRoomsController(IHotelRoom hotelRoomRepo) { _hotelRoomRepo = hotelRoomRepo; }
public HotelRoomsController(IHotelRoom hotelRoom) { _hotelRoom = hotelRoom; }
/// <summary> /// This is the constructor that has the dependency injection in it. /// </summary> /// <param name="context">Takes a DbContext Object and a reference to the IHotelRoom interface</param> public HotelRepository(AsyncInnDbContext context, IHotelRoom hotelRoom) { _context = context; _hotelRoom = hotelRoom; }
public HotelsController(IHotel hotel, IHotelRoom hotelRoom) { _hotelRooms = hotelRoom; _hotel = hotel; }
public HotelRoomsController(IHotelRoom context) { _hotelRoom = context; }
/// <summary> /// Constructor for HotelRepo /// </summary> /// <param name="context">Database context</param> /// <param name="hotel">IHotel reference</param> public HotelRepo(AsyncInnDbContext context, IHotelRoom hotelRoom) { _hotelRoom = hotelRoom; _context = context; }
public HotelRoomController(IHotelRoom repository) { this.repository = repository; }