Пример #1
0
        public IQueryable <Room> GetRooms(string city = null, int?pincode = 0, decimal?price = 0, Room.RoomCategory category = Room.RoomCategory.Cat0)
        {
            List <Room> roomList             = new List <Room>();
            IQueryable <Database.Room> rooms = _dbContext.Rooms.Where(r => (r.Price <= price || price == 0) && (r.Category == (byte)Enum.Parse(typeof(Room.RoomCategory), category.ToString()) || category == Room.RoomCategory.Cat0) && (r.Hotel.City == city || city == null) && (r.Hotel.PINCode == pincode || pincode == 0));

            foreach (var item in rooms)
            {
                roomList.Add(_mapper.Map <Database.Room, Room>(item));
            }

            return(roomList.AsQueryable());
        }
Пример #2
0
 public IQueryable <Room> GetRooms(string city = null, int?pincode = 0, decimal?price = 0, Room.RoomCategory category = Room.RoomCategory.Cat0)
 {
     return(_roomRepository.GetRooms(city, pincode, price, category));
 }
Пример #3
0
 public IHttpActionResult GetRooms(string city, int pincode, decimal price, Room.RoomCategory category)
 {
     _roomManager.GetRooms(city: city, pincode: pincode, price: price, category: category);
     return(Ok());
 }