예제 #1
0
        public IActionResult Index()
        {
            // Retrieves a page from the Xperience database with the '/Home' node alias path
            TreeNode page = _pagesRetriever.Retrieve <TreeNode>(query => query
                                                                .Path("/Home", PathTypeEnum.Single))
                            .FirstOrDefault();

            // Responds with the HTTP 404 error when the page is not found
            if (page == null)
            {
                return(NotFound());
            }

            // Initializes the page data context (and the page builder) using the retrieved page
            _pageDataContextInitializer.Initialize(page);

            var homeSource = HomeProvider.GetHome(Guid.Parse(Home.NodeGuidId), "en-US", "HouseRestaurant");

            var menus  = NavigationProvider.GetMenuItems();
            var dishes = DishProvider.GetDishCategories();

            var vm = new HomeViewModel()
            {
                Id          = homeSource.First().HomeID,
                Description = homeSource.First().Description,
                Title       = homeSource.First().Title,
                MenuItems   = menus,
                Dishes      = dishes
            };


            return(View(vm));
        }