(EX:我想在文本框中添加电话号码,因此只需添加10个号码。不应允许超过10个号码)
答案 0 :(得分:0)
由于您无法访问频道中的前端,因此您必须验证服务器端,因为Nils说。在这个例子中,我使用的是RootDialog.cs,但如果你愿意,也可以在消息控制器中执行。你可以尝试这样的东西,但可能需要做一些while循环来重复多次。
static async Task Execute()
{
string apiKey = "API KEY";
var client = new SendGridClient("DWADwdwdgfeg3efwfewgseg");
var from = new EmailAddress("test@example.com", "Example User");
var subject = "Sending with SendGrid is Fun";
var to = new EmailAddress("miroslav.stojanov@gmail.com", "Example User");
var plainTextContent = "and easy to do anywhere, even with C#";
var htmlContent = "<strong>and easy to do anywhere, even with C#</strong>";
var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
var response = await client.SendEmailAsync(msg);
}
[HttpPost]
[Route("Authorisation/Registration/Save")]
[Transactional]
public JsonResult Save(User eUser, Request eRequest)
{
Execute().Wait();
try
{
//Look at it later
eUser.Password = EncryptHelper.EncryptString(eUser.Password, "kahat");
eUser.Password1 = EncryptHelper.EncryptString(eUser.Password1, "kahat123");
this.rpGeneric.SaveOrUpdate<User>(eUser);
this.rpGeneric.SaveOrUpdate<Request>(eRequest);
return GetAll();
}
catch (Exception ex)
{
return ThrowJsonError(ex);
}
}
答案 1 :(得分:0)
Adaptive cards可以解决此问题 - 您需要使用带有文本输入的卡片进行回复。只需在卡片的标记中明确设置maxLength
属性即可。以下是您需要的标记示例:
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "0.5",
"body": [
{
"type": "Input.Text",
"id": "phone",
"placeholder": "Enter a phone number",
"speak": "Enter a phone number",
"maxLength": 10
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Action.Submit data",
}
]
}