本文整理汇总了C#中Resource.UpdateUrl方法的典型用法代码示例。如果您正苦于以下问题:C# Resource.UpdateUrl方法的具体用法?C# Resource.UpdateUrl怎么用?C# Resource.UpdateUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resource
的用法示例。
在下文中一共展示了Resource.UpdateUrl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildServiceUri
private Uri BuildServiceUri(Resource resource, RestActions action, int? id,
Dictionary<string, string> queryParameters)
{
string relativeUri;
switch (action)
{
case RestActions.Index:
relativeUri = resource.IndexUrl();
break;
case RestActions.Show:
relativeUri = resource.ShowUrl(id);
break;
case RestActions.New:
relativeUri = resource.NewUrl();
break;
case RestActions.Create:
relativeUri = resource.CreateUrl();
break;
case RestActions.Edit:
relativeUri = resource.EditUrl(id);
break;
case RestActions.Update:
relativeUri = resource.UpdateUrl(id);
break;
case RestActions.Delete:
relativeUri = resource.DeleteUrl(id);
break;
default:
relativeUri = resource.IndexUrl();
break;
}
var uriBuilder = new UriBuilder(uri.Scheme, uri.Host, uri.Port,
AddQueryParametersTo(relativeUri + ".xml", queryParameters));
if (UserName.Length != 0)
{
uriBuilder.UserName = UserName;
}
if (Password.Length != 0)
{
uriBuilder.Password = Password;
}
return uriBuilder.Uri;
}