C# Class BetterCms.Module.Pages.Services.DefaultRedirectService

Inheritance: IRedirectService
Datei anzeigen Open project: devbridge/BetterCMS

Public Methods

Method Description
CreateRedirectEntity ( string pageUrl, string redirectUrl ) : Redirect

Checks if such redirect doesn't exists yet and creates new redirect entity.

DefaultRedirectService ( IUnitOfWork unitOfWork, IUrlService urlService, IRepository repository ) : System

Initializes a new instance of the DefaultRedirectService class.

DeleteRedirect ( System.Guid id, int version ) : bool
GetAllRedirects ( ) : IList

Gets the list with all redirects.

GetPageRedirect ( string pageUrl, System.Guid id = null ) : Redirect

Gets redirect, if such redirect exists.

GetRedirect ( string url ) : string

Gets the redirect for given url.

SaveRedirect ( ViewModels model, bool createIfNotExists = false ) : Redirect
ValidateForCircularLoop ( string pageUrl, string redirectUrl, System.Guid id = null ) : void

Validates urls: checks if the the circular loop exists.

ValidateRedirectExists ( string pageUrl, System.Guid id = null ) : void

Checks, if such redirect exists.

Private Methods

Method Description
RecursiveCircularLoop ( IList redirects, string redirectUrl, List checkedIds, string startPageUrl, string startRedirectUrl ) : void

Recursive method checks for circular loops in redirects list.

Method Details

CreateRedirectEntity() public method

Checks if such redirect doesn't exists yet and creates new redirect entity.
public CreateRedirectEntity ( string pageUrl, string redirectUrl ) : Redirect
pageUrl string The page URL.
redirectUrl string The redirect URL.
return Redirect

DefaultRedirectService() public method

Initializes a new instance of the DefaultRedirectService class.
public DefaultRedirectService ( IUnitOfWork unitOfWork, IUrlService urlService, IRepository repository ) : System
unitOfWork IUnitOfWork The unit of work.
urlService IUrlService The URL service.
repository IRepository The repository.
return System

DeleteRedirect() public method

public DeleteRedirect ( System.Guid id, int version ) : bool
id System.Guid
version int
return bool

GetAllRedirects() public method

Gets the list with all redirects.
public GetAllRedirects ( ) : IList
return IList

GetPageRedirect() public method

Gets redirect, if such redirect exists.
public GetPageRedirect ( string pageUrl, System.Guid id = null ) : Redirect
pageUrl string The page URL.
id System.Guid The redirect id.
return Redirect

GetRedirect() public method

Gets the redirect for given url.
public GetRedirect ( string url ) : string
url string The URL.
return string

SaveRedirect() public method

public SaveRedirect ( ViewModels model, bool createIfNotExists = false ) : Redirect
model ViewModels
createIfNotExists bool
return Redirect

ValidateForCircularLoop() public method

Validates urls: checks if the the circular loop exists.
public ValidateForCircularLoop ( string pageUrl, string redirectUrl, System.Guid id = null ) : void
pageUrl string The page URL.
redirectUrl string The redirect URL.
id System.Guid The id.
return void

ValidateRedirectExists() public method

Checks, if such redirect exists.
public ValidateRedirectExists ( string pageUrl, System.Guid id = null ) : void
pageUrl string The page URL.
id System.Guid The redirect id.
return void