====== Orchard Create Page ====== public int UpdateFrom2() { // Create Foo page and attach to menu. var fooPage = _contentManager.Create("Page"); fooPage.As().Title = "Foo"; fooPage.As().Text = @"

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus mauris magna, varius vel vulputate eget, bibendum id magna.

"; fooPage.As().Owner = _orchardServices.WorkContext == null ? null : _orchardServices.WorkContext.CurrentUser; var fooRoute = fooPage.As(); fooRoute.DisplayAlias = _autorouteService.GenerateAlias(fooRoute); _autorouteService.PublishAlias(fooRoute); var menu = _menuService.GetMenu("Main Menu"); if (menu == null) throw new Exception("Could not get the menu. Please the name of the menu is correct."); fooPage.As().Menu = menu; fooPage.As().MenuText = "Article"; fooPage.As().MenuPosition = "10"; _contentManager.Publish(fooPage); // Create Foo layer var fooLayer = _widgetsService.CreateLayer("Foo", "The widgets in this layer will be displayed on the Foo page", "url('~/Foo')"); _contentManager.Publish(fooLayer.ContentItem); return 3; }
{{tag>orchard migration}}