本文整理汇总了C#中IServiceRequest.GetParameter方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceRequest.GetParameter方法的具体用法?C# IServiceRequest.GetParameter怎么用?C# IServiceRequest.GetParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServiceRequest
的用法示例。
在下文中一共展示了IServiceRequest.GetParameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessRequest
public override void ProcessRequest(IServiceRequest request, IServiceResponse response, IResourceRepository resourceRepository)
{
response.ContentType = Constants.CONTENT_TYPE_JSON;
EAEPMessages messages = null;
if (request.GetParameter(Constants.QUERY_STRING_FROM) != null)
{
DateTime from = DateTime.ParseExact(request.GetParameter(Constants.QUERY_STRING_FROM), Constants.FORMAT_DATETIME, CultureInfo.InvariantCulture);
if (request.GetParameter(Constants.QUERY_STRING_TO) != null)
{
messages = monitor.GetMessages(
from,
DateTime.ParseExact(request.GetParameter(Constants.QUERY_STRING_TO), Constants.FORMAT_DATETIME, CultureInfo.InvariantCulture),
request.Query
);
}
else
{
messages = monitor.GetMessages(from, request.Query);
}
}
else
{
messages = monitor.GetMessages(request.Query);
}
using (StreamWriter writer = new StreamWriter(response.ContentStream))
{
string json = JsonConvert.SerializeObject(messages);
writer.Write(json);
}
}
示例2: ProcessRequest
public override void ProcessRequest(IServiceRequest request, IServiceResponse response, IResourceRepository resourceRepository)
{
string[] values = store.Distinct(
request.GetParameter(Constants.QUERY_STRING_FIELD),
DateTime.ParseExact(request.GetParameter(Constants.QUERY_STRING_FROM), Constants.FORMAT_DATETIME, CultureInfo.InvariantCulture),
DateTime.ParseExact(request.GetParameter(Constants.QUERY_STRING_TO), Constants.FORMAT_DATETIME, CultureInfo.InvariantCulture),
request.Query
);
response.ContentType = Constants.CONTENT_TYPE_JSON;
using (StreamWriter writer = new StreamWriter(response.ContentStream))
{
string json = JsonConvert.SerializeObject(values);
writer.Write(json);
}
}
示例3: ProcessRequest
public override void ProcessRequest(IServiceRequest request, IServiceResponse response, IResourceRepository resourceRepository)
{
CountResult[] result = store.Count(
DateTime.ParseExact(request.GetParameter(Constants.QUERY_STRING_FROM), Constants.FORMAT_DATETIME, CultureInfo.InvariantCulture),
DateTime.ParseExact(request.GetParameter(Constants.QUERY_STRING_TO), Constants.FORMAT_DATETIME, CultureInfo.InvariantCulture),
int.Parse(request.GetParameter(Constants.QUERY_STRING_TIMESLICES)),
request.GetParameter(Constants.QUERY_STRING_GROUPBY),
request.Query
);
response.ContentType = Constants.CONTENT_TYPE_JSON;
using (StreamWriter writer = new StreamWriter(response.ContentStream))
{
writer.Write((string) JsonConvert.SerializeObject(result));
}
}