Exemple #1
0
        public List <Advertisement> GetList(string userId, string roomCount = null, string cityId = null)
        {
            List <Advertisement> advertisements = _advertismentDal.GetList(x => x.AddedByAgentId == userId);


            if (roomCount != null || cityId != null)
            {
                advertisements = _advertismentDal.GetList(
                    x => ((!string.IsNullOrEmpty(roomCount) && roomCount != "0") && x.RoomId == roomCount) ||
                    ((!string.IsNullOrEmpty(cityId) && cityId != "0") && x.CityId == cityId));
            }


            List <Room> rooms = _roomDal.GetList();

            List <City> cities = _cityService.GetList();

            advertisements.ForEach(advertisement =>
            {
                cities.ForEach(city =>
                {
                    if (advertisement.CityId == city.Id.ToString())
                    {
                        advertisement.CityId = city.CityName;
                    }
                });

                rooms.ForEach(room =>
                {
                    if (advertisement.RoomId == room.Id.ToString())
                    {
                        advertisement.RoomId = room.RoomCount;
                    }
                });
            });

            return(advertisements);
        }
Exemple #2
0
 public List <Room> GetList()
 {
     return(_roomDal.GetList());
 }
        public List <Room> GetAll()
        {
            var rooms = _mapper.Map <List <Room> >(_roomDal.GetList());//AutoMapperHelper.MapToSameTypeList(_customerDal.GetList());

            return(rooms);
        }