Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions source/MvcNavigation/Node.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Web.Mvc;
Expand All @@ -9,19 +9,21 @@ public class Node<TController> : NodeBase where TController : IController
{
IList<INode> _childNodes;

public Node(Expression<Action<TController>> action) : this(action, null, new INode[0])
public Node(Expression<Action<TController>> action)
: this(action, null, String.Empty, new INode[0])
{
}

public Node(Expression<Action<TController>> action, string title) : this(action, title, new INode[0])
public Node(Expression<Action<TController>> action, string title) : this(action, title, String.Empty, new INode[0])
{
}

public Node(Expression<Action<TController>> action, params INode[] childNodes) : this(action, null, childNodes)
public Node(Expression<Action<TController>> action, params INode[] childNodes)
: this(action, null, String.Empty, childNodes)
{
}

public Node(Expression<Action<TController>> action, string title, params INode[] childNodes)
public Node(Expression<Action<TController>> action, string title, string iconFileName, params INode[] childNodes)
{
if (action == null)
throw new ArgumentNullException("action");
Expand All @@ -33,7 +35,7 @@ public Node(Expression<Action<TController>> action, string title, params INode[]
if (methodCallExpression == null)
throw new ArgumentException("Node must be initialised with method call expression (e.g. controller => controller.Action())", "action");

Initialise(methodCallExpression, title);
Initialise(methodCallExpression, title, iconFileName);
InitialiseChildNodes(childNodes);
}

Expand Down Expand Up @@ -61,16 +63,30 @@ public class Node<TController, TAreaRegistration> : Node<TController> where TCon
{
}

public Node(Expression<Action<TController>> action, string title, string iconFileName)
: this(action, title, iconFileName, new INode[0])
{
}

public Node(Expression<Action<TController>> action, params INode[] childNodes) : this(action, null, childNodes)
{
}

public Node(Expression<Action<TController>> action, string title, params INode[] childNodes) : base(action, title, childNodes)
public Node(Expression<Action<TController>> action, string title, params INode[] childNodes) : base(action, title, String.Empty, childNodes)
{
// ReSharper disable DoNotCallOverridableMethodsInConstructor
AreaName = Activator.CreateInstance<TAreaRegistration>().AreaName;
SetAreaName(RouteValues, AreaName);
// ReSharper restore DoNotCallOverridableMethodsInConstructor
}

public Node(Expression<Action<TController>> action, string title, string iconFileName, params INode[] childNodes)
: base(action, title, iconFileName, childNodes)
{
// ReSharper disable DoNotCallOverridableMethodsInConstructor
AreaName = Activator.CreateInstance<TAreaRegistration>().AreaName;
SetAreaName(RouteValues, AreaName);
// ReSharper restore DoNotCallOverridableMethodsInConstructor
}
}
}
}