本文整理汇总了C#中System.Web.Http.User.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# User.GetType方法的具体用法?C# User.GetType怎么用?C# User.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Http.User
的用法示例。
在下文中一共展示了User.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Post
/// <summary>
/// Asks the service to asynchronously create a new user, using the supplied information.
/// </summary>
/// <param name="data">
/// The supplied POST-data used to create a new user.
/// </param>
/// <returns>
/// HTTP Status Code 201 - Created + Unique link to newly created user,
/// 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 user 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(User data)
{
var result = await _userService.CreateAsync(data);
switch (result.ActionStatus.Status)
{
case ActionStatusEnum.Success:
return CreateHttpActionResult("UserAsync", 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(decimal id, User data)
{
data.Id = id;
var result = await _userService.UpdateAsync(data);
switch (result.ActionStatus.Status)
{
case ActionStatusEnum.Success:
return result.ActionStatus.SubStatus == ActionSubStatusEnum.Created
? CreateHttpActionResult("UserAsync", result.ActionStatus.Id)
: StatusCode(HttpStatusCode.NoContent);
case ActionStatusEnum.ValidationError:
return ApiControllerExtension.BadRequest(this, result.BrokenValidationRules, data.GetType().Name);
}
return HandleErrorActionResult(result);
}