本文整理汇总了C#中Services.hat方法的典型用法代码示例。如果您正苦于以下问题:C# Services.hat方法的具体用法?C# Services.hat怎么用?C# Services.hat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services.hat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReceiveSMS
public IHttpActionResult ReceiveSMS(SmsMessage smsMessage)
{
Services services = new Services(smsMessage);
services.SaveMessage(smsMessage);
var twilio = new TwilioRestClient(ConfigurationManager.AppSettings["TwilioAccountKey"],
ConfigurationManager.AppSettings["TwilioAuthToken"]);
if (smsMessage.Body.ToLower().StartsWith("play"))
{
services.CreateGame(smsMessage);
twilio.SendMessage(ConfigurationManager.AppSettings["TwilioNumber"],
smsMessage.From,
smsMessage.Body.Substring(smsMessage.Body.ToLower().IndexOf("play") + 4) +
", I'm ready for your first question!");
}
else
{
if (services.Game == null)
{
twilio.SendMessage(ConfigurationManager.AppSettings["TwilioNumber"],
smsMessage.From,
"Sorry, I can't find your game.");
return Ok();
}
if (services.Character == null)
{
twilio.SendMessage(ConfigurationManager.AppSettings["TwilioNumber"],
smsMessage.From,
"Sorry, I can't find the character your game started with.");
return Ok();
}
if (smsMessage.Body.ToLower().StartsWith("male"))
{
Respond(services.gender(Gender.male), smsMessage, twilio);
services.Update();
}
else if (smsMessage.Body.ToLower().StartsWith("female"))
{
Respond(services.gender(Gender.female), smsMessage, twilio);
services.Update();
}
else if (smsMessage.Body.ToLower().StartsWith("hair"))
{
if (services.hair(smsMessage.Body.Substring(5)))
{
twilio.SendMessage(ConfigurationManager.AppSettings["TwilioNumber"],
smsMessage.From,
"Yes.");
}
else
{
twilio.SendMessage(ConfigurationManager.AppSettings["TwilioNumber"],
smsMessage.From,
"No.");
}
services.Update();
}
else if (smsMessage.Body.ToLower().StartsWith("eyes"))
{
if (services.eyes(smsMessage.Body.Substring(5)))
{
twilio.SendMessage(ConfigurationManager.AppSettings["TwilioNumber"],
smsMessage.From,
"Yes.");
}
else
{
twilio.SendMessage(ConfigurationManager.AppSettings["TwilioNumber"],
smsMessage.From,
"No.");
}
services.Update();
}
else if (smsMessage.Body.ToLower().StartsWith("hat"))
{
Respond(services.hat(), smsMessage, twilio);
services.Update();
}
else if (smsMessage.Body.ToLower().StartsWith("beard"))
{
Respond(services.beard(), smsMessage, twilio);
services.Update();
}
else if (smsMessage.Body.ToLower().StartsWith("glasses"))
{
Respond(services.glasses(), smsMessage, twilio);
services.Update();
}
else if (smsMessage.Body.ToLower().StartsWith("moustache"))
{
Respond(services.moustache(), smsMessage, twilio);
services.Update();
}
else if (smsMessage.Body.ToLower().StartsWith("bald"))
{
Respond(services.bald(), smsMessage, twilio);
services.Update();
}
else if (smsMessage.Body.ToLower().StartsWith("is it"))
{
if (services.guess(smsMessage.Body.Substring(6)))
//.........这里部分代码省略.........