namespace CodeLiturgy.Views.Utils
{
///
/// Url container.
///
public class Url
{
///
/// Name of the URL
///
public readonly string Name;
///
/// Location of the URL (URI).
///
public readonly string Location;
///
/// Url constructor.
///
/// Name of the URL
/// Location of the URL (URI).
public Url(string name, string location)
{
Name = name;
Location = location;
}
}
///
/// A record representing a main view on the site
///
/// The name of the view
/// A unique key for this view.
/// The unique URL for this view.
/// Controller name.
/// Children views of this view.
/// Type of this view.
public record RouteRecord(string Name, string RouteKey, string Location, string ControllerName, List Children, ViewType ViewType = ViewType.Undefined)
{
///
/// Children to Url List.
///
///
public List ChildrenToUrl()
{
return Children.Select(x => x.ToUrl()).ToList();
}
public Url ToUrl()
{
return new Url(Name, Location);
}
public Url ToUrl(string name)
{
return new Url(name, Location);
}
}
}