Page repository

Håkan Edling edited this page Nov 25, 2016 · 2 revisions

GetStartpage

// Gets the startpage as a dynamic model.
DynamicPage GetStartpage()

// Gets the startpage as a strongly typed model.
T GetStartpage<T>() where T : Page<T>

Get the startpage of the site. In Piranha the startpage is the first page on the first level of the page hierarchy.

GetById

// Gets the dynamic model with the specified id.
DynamicPage GetById(Guid id)

// Gets the strongly typed model with the specified id.
T GetById<T>(Guid id) where T : Page<T>

Gets the page with the specified unique id. If no page is found with the specified id, null is returned.

GetBySlug

// Gets the dynamic model with the specified slug.
DynamicPage GetBySlug(string slug)

// Gets the strongly typed model with the specified slug.
T GetBySlug<T>(string slug) where T : Page<T>

Gets the page with the specified unique slug. If no page is found with the specified slug, null is returned.

GetByParentId

// Gets the dynamic models with the specified parent id.
IList<DynamicPage> GetByParentId(Guid? parentId);

Gets the pages with the specified parent id. If null is given as parent id the pages on the first level in the hierarchy is returned.

Save

// Saves the given page model.
void Save<T>(T model) where T : Page<T>

Saves the given page model. This method works for both strongly typed and dynamic page models.

Delete

// Deletes the given page model
void Delete<T>(T model) where T : Page<T>

// Deletes the page with the given id
void Delete(Guid id)

Deletes the specified page.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.