protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { //create the table if it does not exist var db = applicationContext.DatabaseContext.Database; if (db.TableExist("venues") == false) { //table creation db.CreateTable <Venue>(true); //test data creation VenuesApiController ap = new VenuesApiController(); ap.PostSave(new Venue() { Name = "Taj Mahal", Description = "The Taj Mahal (meaning Crown of the Palace) is an ivory-white marble mausoleum on the south bank of the Yamuna river in the Indian city of Agra.", Address = "Taj Mahal, Agra, Uttar Pradesh, Indien" }); ap.PostSave(new Venue() { Name = "The O2", Description = "The O2 Arena is the world's largest building by measure of floor space, and has the second-highest seating capacity of any indoor venue in the United Kingdom.", Address = "The O2 London" }); ap.PostSave(new Venue() { Name = "Himalayas", Description = "The Himalayan range has many of the Earth's highest peaks, including the highest, Mount Everest. The Himalayas include over fifty mountains.", Address = "Himalayas", Images = new Rune().GetGalleryImages() }); } // Gets a reference to the section if the section is already added Section section = applicationContext.Services.SectionService.GetByAlias(VenueSectionAlias); if (section != null) { return; } //Add a Venues Section applicationContext.Services.SectionService.MakeNew("Venues", VenueSectionAlias, "icon-map-location"); }
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { //check if we're rendering the root node's children if (id == Constants.System.Root.ToInvariantString()) { var ctrl = new VenuesApiController(); var nodes = new TreeNodeCollection(); foreach (var venue in ctrl.GetAll()) { var node = CreateTreeNode(venue.Id.ToString(), "-1", queryStrings, venue.Name, "icon-presentation", false); nodes.Add(node); } return(nodes); } //this tree doesn't suport rendering more than 1 level throw new NotSupportedException(); }