本文整理汇总了C#中System.Web.Mvc.UrlHelper.GetUmbracoApiService方法的典型用法代码示例。如果您正苦于以下问题:C# UrlHelper.GetUmbracoApiService方法的具体用法?C# UrlHelper.GetUmbracoApiService怎么用?C# UrlHelper.GetUmbracoApiService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Mvc.UrlHelper
的用法示例。
在下文中一共展示了UrlHelper.GetUmbracoApiService方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AfterMap
private static void AfterMap(IMedia media, MediaItemDisplay display)
{
//map the tree node url
if (HttpContext.Current != null)
{
var urlHelper = new UrlHelper(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData()));
var url = urlHelper.GetUmbracoApiService<MediaTreeController>(controller => controller.GetTreeNode(display.Id.ToString(), null));
display.TreeNodeUrl = url;
}
if (media.ContentType.IsContainer)
{
TabsAndPropertiesResolver.AddContainerView(display, "media");
}
TabsAndPropertiesResolver.MapGenericProperties(media, display);
}
示例2: ServerVariablesParserOnParsing
private void ServerVariablesParserOnParsing(object sender, Dictionary<string, object> e) {
// Create a new UrlHelper (can we grab the one from the DashboardContext?)
UrlHelper url = new UrlHelper(HttpContext.Current.Request.RequestContext);
// Get the default service URL
string serviceUrl = url.GetUmbracoApiService<DashboardController>("ActionName").TrimEnd("ActionName");
// Hijack/replace Umbraco's default dashboard controller
Dictionary<string, object> umbracoUrls = e["umbracoUrls"] as Dictionary<string, object>;
if (umbracoUrls != null) umbracoUrls["dashboardApiBaseUrl"] = serviceUrl;
// Add our own server variables for the dashboard
e.Add("SkybrudDashboard", new {
serviceUrl
});
}
示例3: AddServerVariables
/// <summary>
/// Adds server variables for use by the JavaScript.
/// </summary>
private void AddServerVariables(object sender,
Dictionary<string, object> e)
{
// Variables.
var httpContext = new HttpContextWrapper(HttpContext.Current);
var routeData = new RouteData();
var requestContext = new RequestContext(httpContext, routeData);
var helper = new UrlHelper(requestContext);
var key = Constants.PackageNameCamelCase;
// Add server variables.
e.Add(key, new Dictionary<string, string>()
{
{ "DeleteForm",
helper.GetUmbracoApiService<FormsController>(x =>
x.DeleteForm(null)) },
{ "PersistForm",
helper.GetUmbracoApiService<FormsController>(x =>
x.PersistForm(null)) },
{ "GetFormInfo",
helper.GetUmbracoApiService<FormsController>(x =>
x.GetFormInfo(null)) },
{ "DeleteLayout",
helper.GetUmbracoApiService<LayoutsController>(x =>
x.DeleteLayout(null)) },
{ "PersistLayout",
helper.GetUmbracoApiService<LayoutsController>(x =>
x.PersistLayout(null)) },
{ "GetLayoutInfo",
helper.GetUmbracoApiService<LayoutsController>(x =>
x.GetLayoutInfo(null)) },
{ "DeleteValidation",
helper.GetUmbracoApiService<ValidationsController>(x =>
x.DeleteValidation(null)) },
{ "PersistValidation",
helper.GetUmbracoApiService<ValidationsController>(x =>
x.PersistValidation(null)) },
{ "GetValidationInfo",
helper.GetUmbracoApiService<ValidationsController>(x =>
x.GetValidationInfo(null)) },
{ "GetValidationsInfo",
helper.GetUmbracoApiService<ValidationsController>(x =>
x.GetValidationsInfo(null)) },
{ "PersistFolder",
helper.GetUmbracoApiService<FoldersController>(x =>
x.PersistFolder(null)) },
{ "GetFieldTypes",
helper.GetUmbracoApiService<FieldsController>(x =>
x.GetFieldTypes()) },
{ "PermitAccess",
helper.GetUmbracoApiService<SetupController>(x =>
x.PermitAccessToFormulate()) },
{ "GetEntityChildren",
helper.GetUmbracoApiService<EntitiesController>(x =>
x.GetEntityChildren(null)) },
{ "GetEntity",
helper.GetUmbracoApiService<EntitiesController>(x =>
x.GetEntity(null)) },
{ "EditLayoutBase", "/formulate/formulate/editLayout/" },
{ "EditValidationBase",
"/formulate/formulate/editValidation/" },
{ "Validation.RootId", ValidationConstants.Id }
});
}
示例4: ShouldIgnoreTicketRenew
/// <summary>
/// Determines if the authentication ticket should be renewed with a new timeout
/// </summary>
/// <param name="url"></param>
/// <param name="httpContext"></param>
/// <returns></returns>
/// <remarks>
/// We do not want to renew the ticket when we are checking for the user's remaining timeout unless -
/// UmbracoConfig.For.UmbracoSettings().Security.KeepUserLoggedIn == true
/// </remarks>
internal static bool ShouldIgnoreTicketRenew(Uri url, HttpContextBase httpContext)
{
//this setting will renew the ticket for all requests.
if (UmbracoConfig.For.UmbracoSettings().Security.KeepUserLoggedIn)
{
return false;
}
//initialize the ignore ticket urls - we don't need to lock this, it's concurrent and a hashset
// we don't want to have to gen the url each request so this will speed things up a teeny bit.
if (IgnoreTicketRenewUrls.Any() == false)
{
var urlHelper = new UrlHelper(new RequestContext(httpContext, new RouteData()));
var checkSessionUrl = urlHelper.GetUmbracoApiService<AuthenticationController>(controller => controller.GetRemainingTimeoutSeconds());
IgnoreTicketRenewUrls.Add(checkSessionUrl);
}
if (IgnoreTicketRenewUrls.Any(x => url.AbsolutePath.StartsWith(x)))
{
return true;
}
return false;
}
示例5: AddServerVariables
/// <summary>
/// Adds server variables for use by the JavaScript.
/// </summary>
private void AddServerVariables(object sender,
Dictionary<string, object> e)
{
// Variables.
var httpContext = new HttpContextWrapper(HttpContext.Current);
var routeData = new RouteData();
var requestContext = new RequestContext(httpContext, routeData);
var helper = new UrlHelper(requestContext);
var key = Constants.PackageNameCamelCase;
// Add server variables.
e.Add(key, new Dictionary<string, string>()
{
{ "DeleteForm",
helper.GetUmbracoApiService<FormsController>(x =>
x.DeleteForm(null)) },
{ "PersistForm",
helper.GetUmbracoApiService<FormsController>(x =>
x.PersistForm(null)) },
{ "GetFormInfo",
helper.GetUmbracoApiService<FormsController>(x =>
x.GetFormInfo(null)) },
{ "MoveForm",
helper.GetUmbracoApiService<FormsController>(x =>
x.MoveForm(null)) },
{ "DeleteConfiguredForm",
helper.GetUmbracoApiService<ConfiguredFormsController>(x =>
x.DeleteConfiguredForm(null)) },
{ "PersistConfiguredForm",
helper.GetUmbracoApiService<ConfiguredFormsController>(x =>
x.PersistConfiguredForm(null)) },
{ "GetConfiguredFormInfo",
helper.GetUmbracoApiService<ConfiguredFormsController>(x =>
x.GetConfiguredFormInfo(null)) },
{ "DeleteLayout",
helper.GetUmbracoApiService<LayoutsController>(x =>
x.DeleteLayout(null)) },
{ "PersistLayout",
helper.GetUmbracoApiService<LayoutsController>(x =>
x.PersistLayout(null)) },
{ "GetLayoutInfo",
helper.GetUmbracoApiService<LayoutsController>(x =>
x.GetLayoutInfo(null)) },
{ "GetLayoutKinds",
helper.GetUmbracoApiService<LayoutsController>(x =>
x.GetLayoutKinds()) },
{ "MoveLayout",
helper.GetUmbracoApiService<LayoutsController>(x =>
x.MoveLayout(null)) },
{ "DeleteValidation",
helper.GetUmbracoApiService<ValidationsController>(x =>
x.DeleteValidation(null)) },
{ "PersistValidation",
helper.GetUmbracoApiService<ValidationsController>(x =>
x.PersistValidation(null)) },
{ "GetValidationInfo",
helper.GetUmbracoApiService<ValidationsController>(x =>
x.GetValidationInfo(null)) },
{ "GetValidationsInfo",
helper.GetUmbracoApiService<ValidationsController>(x =>
x.GetValidationsInfo(null)) },
{ "GetValidationKinds",
helper.GetUmbracoApiService<ValidationsController>(x =>
x.GetValidationKinds()) },
{ "MoveValidation",
helper.GetUmbracoApiService<ValidationsController>(x =>
x.MoveValidation(null)) },
{ "DeleteDataValue",
helper.GetUmbracoApiService<DataValuesController>(x =>
x.DeleteDataValue(null)) },
{ "PersistDataValue",
helper.GetUmbracoApiService<DataValuesController>(x =>
x.PersistDataValue(null)) },
{ "GetDataValueInfo",
helper.GetUmbracoApiService<DataValuesController>(x =>
x.GetDataValueInfo(null)) },
{ "GetDataValuesInfo",
helper.GetUmbracoApiService<DataValuesController>(x =>
x.GetDataValuesInfo(null)) },
{ "GetDataValueKinds",
helper.GetUmbracoApiService<DataValuesController>(x =>
x.GetDataValueKinds()) },
{ "GetDataValueSuppliers",
helper.GetUmbracoApiService<DataValuesController>(x =>
x.GetDataValueSuppliers()) },
{ "MoveDataValue",
helper.GetUmbracoApiService<DataValuesController>(x =>
x.MoveDataValue(null)) },
{ "PersistFolder",
helper.GetUmbracoApiService<FoldersController>(x =>
x.PersistFolder(null)) },
{ "GetFolderInfo",
helper.GetUmbracoApiService<FoldersController>(x =>
x.GetFolderInfo(null)) },
{ "MoveFolder",
helper.GetUmbracoApiService<FoldersController>(x =>
x.MoveFolder(null)) },
//.........这里部分代码省略.........