예제 #1
0
        public void DataBaseToExcell()
        {
            var list = _roomsRepository.GetAll()
                       .Include(b => b.NumberHouse)
                       .Include(s => s.NumberHouse.Street)
                       .Include(cr => cr.NumberHouse.Street.District)
                       .Include(c => c.NumberHouse.Street.District.City)
                       .Select(r => new RoomShowViewModel
            {
                RoomCity        = r.NumberHouse.Street.District.City.Name,
                RoomDistrict    = r.NumberHouse.Street.District.Name,
                RoomStreet      = r.NumberHouse.Street.Name,
                RoomNumberHouse = r.NumberHouse.Number,
                NumberRoom      = r.NumberRoom,
                CountRoom       = r.CountRooms,
                Floor           = r.Floor,
                Square          = r.Square,
                Price           = r.Price,
                Reserved        = r.Reserved,
                Sales           = r.Sales,
            }).ToList();


            ExportToExcell.WriteExcel(list);
        }
        public IList <Room> GetRooms(int houseId)
        {
            var rez = _roomsRepository.GetAll()
                      .Where(p => p.HouseId == houseId)
                      .OrderBy(c => c.NumberRoom)
                      .ToList();

            return(rez);
        }
예제 #3
0
        public IReadOnlyCollection <RoomModel> GetAll()
        {
            var rooms  = _roomsRepository.GetAll();
            var result = _mapper.Map <IReadOnlyCollection <RoomModel> >(rooms);

            return(result);
        }
 public List <Rooms> GetAll()
 {
     try
     {
         return(_roomsRepository.GetAll().ToList());
     }
     catch (Exception)
     {
         throw;
     }
 }
 public ActionResult <Dictionary <string, List <Rooms> > > GetAll()
 {
     try
     {
         var list = repository.GetAll();
         Dictionary <string, List <Rooms> > result = new Dictionary <string, List <Rooms> >();
         result.Add("Rooms", list);
         return(Ok(result));
     }
     catch (System.Exception msg)
     {
         return(NotFound(msg));
     }
 }