Began integration of Stephen's new routing logic. The sln compiles and things have been refactored
from the initial concept. The module is not active as it currently will not work because of contructor dependencies and classes marked as internal, will liase with Stephen regarding this.
This commit is contained in:
28
src/Umbraco.Web/Mvc/ControllerExtensions.cs
Normal file
28
src/Umbraco.Web/Mvc/ControllerExtensions.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Web.Mvc
|
||||
{
|
||||
public static class ControllerExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Return the controller name from the controller type
|
||||
/// </summary>
|
||||
/// <param name="controllerType"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetControllerName(Type controllerType)
|
||||
{
|
||||
return controllerType.Name.Substring(0, controllerType.Name.LastIndexOf("Controller"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the controller name from the controller type
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
/// <remarks></remarks>
|
||||
public static string GetControllerName<T>()
|
||||
{
|
||||
return GetControllerName(typeof(T));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user