本文整理汇总了C#中Topic.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Topic.GetType方法的具体用法?C# Topic.GetType怎么用?C# Topic.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topic
的用法示例。
在下文中一共展示了Topic.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Post
/// <summary>
/// Asks the service to asynchronously create a new topic, using the supplied information.
/// </summary>
/// <param name="data">
/// The supplied POST-data used to create a new topic.
/// </param>
/// <returns>
/// HTTP Status Code 201 - Created + Unique link to newly created topic,
/// HTTP Status Code 400 - Bad Request if no ID was returned, or the supplied POST-data failed validation. Also contains information on failed validation cases.
/// HTTP Status Code 409 - Conflict if a topic with a provided unique value already exists,
/// HTTP Status Code 500 - Internal Server Error if the other codes don't apply. Contains exception on DEBUG.
/// </returns>
public async Task<IHttpActionResult> Post(Topic data)
{
var result = await _topicService.CreateAsync(data);
switch (result.ActionStatus.Status)
{
case ActionStatusEnum.Success:
return CreateHttpActionResult("TopicAsync", result.ActionStatus.Id);
case ActionStatusEnum.ValidationError:
return ApiControllerExtension.BadRequest(this, result.BrokenValidationRules, data.GetType().Name);
case ActionStatusEnum.Conflict:
return Conflict();
}
return HandleErrorActionResult(result);
}
示例2: Put
public async Task<IHttpActionResult> Put(int id, Topic data)
{
data.Id = id;
var result = await _topicService.UpdateAsync(data);
switch (result.ActionStatus.Status)
{
case ActionStatusEnum.Success:
return result.ActionStatus.SubStatus == ActionSubStatusEnum.Created
? CreateHttpActionResult("TopicAsync", result.ActionStatus.Id)
: StatusCode(HttpStatusCode.NoContent);
case ActionStatusEnum.ValidationError:
return ApiControllerExtension.BadRequest(this, result.BrokenValidationRules, data.GetType().Name);
}
return HandleErrorActionResult(result);
}