当前位置: 首页>>代码示例>>C#>>正文


C# User.GetType方法代码示例

本文整理汇总了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);
        }
开发者ID:Bio2hazard,项目名称:ShortStuff,代码行数:28,代码来源:UserAsyncController.cs

示例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);
        }
开发者ID:Bio2hazard,项目名称:ShortStuff,代码行数:17,代码来源:UserAsyncController.cs


注:本文中的System.Web.Http.User.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。