本文整理汇总了C#中Entities.ToMerge方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.ToMerge方法的具体用法?C# Entities.ToMerge怎么用?C# Entities.ToMerge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities
的用法示例。
在下文中一共展示了Entities.ToMerge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public async Task<IHttpActionResult> Execute(Entities.Slack.SlashCommand command)
{
if (string.IsNullOrWhiteSpace(slackToken))
{
throw new ArgumentNullException("No token provided.");
}
if (string.IsNullOrWhiteSpace(endpoint))
{
throw new ArgumentNullException("No endpoint provided.");
}
if(command.token != slackToken)
{
throw new AuthenticationException("Authorization failed.");
}
Entities.Merge merge;
try
{
merge = command.ToMerge();
using(var client = new HttpClient())
{
await client.PostAsJsonAsync<Entities.Slack.SlashCommand>(endpoint, command);
}
}
catch
{
return Json("An error ouccured while scheduling your command. Command: " + command.text);
}
return Json("Your command has been scheduled successfully. Merging " + merge.HumanReadable());
}
示例2: ForMerge
public static Entities.Merge ForMerge(Entities.Slack.SlashCommand command)
{
return command.ToMerge();
}