public static string SearchPageUrl()
        {
            var    umbContent    = UmbracoAssignedContentHelper.PageContentForIEnumerableIPublishedContent("homePage");
            string searchPageUrl = umbContent.First().GetPropertyValue <IPublishedContent>("searchPage").Url;

            return(searchPageUrl);
        }
Пример #2
0
        public JsonResult GetCurrentBookings()
        {
            List <IPublishedContent> bookingDetails = UmbracoAssignedContentHelper.PageContentForIEnumerableIPublishedContent("bookings").DescendantsOrSelf("year").Where(x => x.GetPropertyValue <bool>("archiveYear") == false).SelectMany(x => x.Children).Where(x => x.GetPropertyValue <bool>("bookingConfirmed")).ToList();

            List <string> bookingModel = new List <string>();

            foreach (var booking in bookingDetails)
            {
                var bookingDatesArrive = booking.GetPropertyValue <DateTime>("startDate");
                var bookingDatesDepart = booking.GetPropertyValue <DateTime>("endDate");

                for (var dt = bookingDatesArrive; dt <= bookingDatesDepart; dt = dt.AddDays(1))
                {
                    bookingModel.Add(dt.ToString("yyyy-MM-dd"));
                }
            }
            return(Json(new { BookingArray = bookingModel.ToArray() }, JsonRequestBehavior.AllowGet));
        }