コード例 #1
0
        public IHttpActionResult GetHotelById(long hotelId)
        {
            var reurnHotel = _hotelFacade.GetHotel(hotelId, TenantId);

            reurnHotel.ImagesURL = new List <string>();
            string path         = HostingEnvironment.MapPath("~/Images/") + "\\" + "Hotel-" + reurnHotel.HotelId;
            var    imageCounter = Directory.Exists(path) ? Directory
                                  .GetFiles(path)
                                  .Count(x => !Path.GetFileName(x).Contains("thumb")) : -1;
            int id = 1;

            while (id < imageCounter + 1)
            {
                reurnHotel.ImagesURL.Add(Url.Link("HotelImage", new { hotelId = reurnHotel.HotelId, imageId = id }));
                id++;
            }


            return(Ok(reurnHotel));
        }