public ActionResult Index() { // Note: the GetRoutedData extension method uses the partial router to // convert a URL segment into a Category instance. var category = Request.RequestContext.GetRoutedData <Category>(); var categoriesPages = contentLoader .GetChildren <CategoriesPage>(ContentReference.StartPage); CategoriesPage currentPage = null; if (categoriesPages.Count() > 0) { currentPage = categoriesPages.First(); } var model = PageViewModel.Create(currentPage); model.CurrentPage.NorthwindCategory = category; return(View("~/Features/NorthwindPartialRouter/Category.cshtml", model)); }
// Notifications API is asynchronous // channel parameter can be used to filter messages public async Task <ActionResult> Index(NotificationsPage currentPage, string channel) { // always reset the Ignore property to an empty dictionary currentPage.Notifications = new Dictionary <string, PagedUserNotificationMessageResult>(); // get a list of the first 30 registered users IEnumerable <IUIUser> users = userProvider.GetAllUsers( pageIndex: 0, pageSize: 30, totalRecords: out int totalRecords); foreach (IUIUser user in users) { // get an object that represents notifications for each user INotificationUser notificationUser = await queryableNotificationUserService.GetAsync(user.Username); // build a query that includes read and unread and sent and unsent messages var query = new UserNotificationsQuery { Read = null, // include read and unread Sent = null, // include sent and unsent User = notificationUser }; // if a channel name is set, use it to filter the notifications if (!string.IsNullOrWhiteSpace(channel)) { ViewData["channel"] = channel; query.ChannelName = channel; } // execute the query var result = await userNotificationRepository.GetUserNotificationsAsync( query, startIndex : 0, maxRows : 20); // store the query results for the user currentPage.Notifications.Add(user.Username, result); } return(View(PageViewModel.Create(currentPage))); }
public ActionResult Delete(DeleteContentPage currentPage, ContentReference contentReference, string hardDelete) { string name = repo.Get <IContent>(contentReference).Name; if (hardDelete == "on") { repo.Delete(contentReference, forceDelete: true, access: AccessLevel.NoAccess); ViewData["message"] = $"'{name}' was deleted permanently."; } else { repo.Move(contentReference, destination: ContentReference.WasteBasket, requiredSourceAccess: AccessLevel.NoAccess, requiredDestinationAccess: AccessLevel.NoAccess); ViewData["message"] = $"'{name}' was moved to trash."; } var viewmodel = PageViewModel.Create(currentPage); return(View("Index", viewmodel)); }
public override ActionResult Index(ServicePage currentPage) { return(PartialView(PageViewModel.Create(currentPage))); }
public ActionResult Index(MasterPage currentPage) { var model = PageViewModel.Create(currentPage); return(View(model)); }
public ActionResult Index(WorkLandingPage currentPage) { PageViewModel <WorkLandingPage> model = PageViewModel.Create(currentPage); return(View(model)); }
public ActionResult Index(DeleteContentPage currentPage) { var viewmodel = PageViewModel.Create(currentPage); return(View(viewmodel)); }
public ActionResult Index(ContactPage currentPage) { PageViewModel <ContactPage> model = PageViewModel.Create(currentPage); return(View(model)); }
public override ActionResult Index(SitePageData currentPage) { return(PartialView(viewName: SiteTags.Narrow, model: PageViewModel.Create(currentPage))); }
public ActionResult Index(ServicePage currentPage) { PageViewModel <ServicePage> model = PageViewModel.Create(currentPage); return(View(model)); }
public ActionResult Index(DeleteContentPage currentPage) { var viewmodel = PageViewModel.Create(currentPage); return(View("~/Features/DeleteContent/DeleteContentPage.cshtml", viewmodel)); }
public override ActionResult Index(FullRefreshDemo currentPage) { return(PartialView(PageViewModel.Create(currentPage))); }
public override ActionResult Index(ProductPage currentPage) { var viewmodel = PageViewModel.Create(currentPage); return(PartialView(viewmodel)); }
public ActionResult Index(TestsPage currentPage) { //retrieving the start page from the current page (current page must not be a sibling of Start page) var startPage = _contentLoader.GetAncestorOrSelf <StartPage>(currentPage); //test the 'or self' part of the function - must return the currentPage var selfPage = _contentLoader.GetAncestorOrSelf <TestsPage>(currentPage); //testing the 'get ancestor' function var ancestorSitePage = _contentLoader.GetAncestor <StartPage>(currentPage); //find the first descendent with the name = 'Find a reseller' var descendentTest = _contentLoader.GetDescendent <StandardPage>(startPage, x => x.Name == "Find a reseller"); //find all the ancestors of the 'Find a reseller' page var ancestors = _contentLoader.GetAncestors(descendentTest); //find all the standard page ancestors of the 'Find a reseller' page var ancestorsPredicateType = _contentLoader.GetAncestors <StandardPage>(descendentTest); //find all the ancestors with more than 2 children Func <IContent, bool> predicateNumChildren = x => _contentLoader.GetChildren <IContentData>(x.ContentLink).Count() > 2; var ancestorsPredicateNumChildren = _contentLoader.GetAncestors(descendentTest, predicateNumChildren); //find the first product descendant of start page var descendantCurrentPage = _contentLoader.GetDescendent <ProductPage>(startPage); //find the first descendant of start page that is a standard page and starts with 'White' var descendentMultiPredicate = _contentLoader.GetDescendent <StandardPage>(startPage, x => x.Name.StartsWith("White")); //find all the product descendents of start page var descendentsProductPages = _contentLoader.GetDescendents <ProductPage>(startPage); //find all the siblings of the current page var testSiblingsCurrentPage = _contentLoader.Siblings(currentPage); //find all the product siblings of the current page var testTypedSiblingsCurrentPage = _contentLoader.Siblings <ProductPage>(currentPage); //find the next sibling by name of the page named 'alloy plan' var alloyPlanPage = _contentLoader.FirstChild <IContent>(ContentReference.StartPage); var nextSibling = _contentLoader.FollowingSibling <IContent, string>(alloyPlanPage, x => x.Name); //find the previous sibling by 'sort order' property Func <IContent, int> sortingPredicate = x => (int)x.Property["PagePeerOrder"].Value; var previousSibling = _contentLoader.PreviousSibling <ProductPage, int>(currentPage, sortingPredicate); var testValues = new TestsViewModel { TestAncestorStartPage = startPage, TestAncestorOrSelf = selfPage, TestAncestor = ancestorSitePage, TestDescendentWithPredicate = descendentTest, TestAncestors = ancestors, TestAncestorsPredicateType = ancestorsPredicateType, TestAncestorsPredicateNumChildren = ancestorsPredicateNumChildren, TestStartDescendentProductPage = descendantCurrentPage, TestDescendentMultiPredicate = descendentMultiPredicate, TestDescendentsPredicateType = descendentsProductPages, TestSiblingsCurrentPage = testSiblingsCurrentPage, TestTypedSiblingsCurrentPage = testTypedSiblingsCurrentPage, TestNextSiblingByName = nextSibling, TestPreviousSiblingBySortOrder = previousSibling, }; ViewBag.TestsObjects = testValues; var model = PageViewModel.Create(currentPage); return(View(model)); }
public ActionResult Index(StartPage currentPage) { var viewModel = PageViewModel.Create(currentPage); return(View(viewModel)); }
public override ActionResult Index(StandardPage currentPage) { return(PartialView(viewName: SiteTags.Wide, model: PageViewModel.Create(currentPage))); }