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


C# Topic.GetType方法代码示例

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

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


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