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


C# HttpVerbs类代码示例

本文整理汇总了C#中HttpVerbs的典型用法代码示例。如果您正苦于以下问题:C# HttpVerbs类的具体用法?C# HttpVerbs怎么用?C# HttpVerbs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HttpVerbs类属于命名空间,在下文中一共展示了HttpVerbs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddEntryToList

 private static void AddEntryToList(HttpVerbs verbs, HttpVerbs match, List<string> verbList, string entryText)
 {
     if ((verbs & match) != 0)
     {
         verbList.Add(entryText);
     }
 }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:7,代码来源:AcceptVerbsAttribute.cs

示例2: DynamicApiActionInfo

 /// <summary>
 /// 初始化一个新的<see cref="DynamicApiActionInfo"/>实例
 /// </summary>
 /// <param name="actionName">Action 名称</param>
 /// <param name="verb">HTTP Verb</param>
 /// <param name="method">一个方法信息,随着 Action 的调用而调用</param>
 /// <param name="filters">用于 Controller Action 的动态筛选器</param>
 public DynamicApiActionInfo(string actionName, HttpVerbs verb, MethodInfo method, IFilter[] filters = null)
 {
     ActionName = actionName;
     Verb = verb;
     Method = method;
     Filters = filters ?? new IFilter[] { };
 }
开发者ID:yangganggood,项目名称:EMP,代码行数:14,代码来源:DynamicApiActionInfo.cs

示例3: CheckForBindingInPutOperations

 protected static void CheckForBindingInPutOperations(HttpVerbs requestVerb)
 {
     if (requestVerb == HttpVerbs.PUT)
     {
         throw DataServiceException.CreateBadRequestError(System.Data.Services.Strings.BadRequest_CannotUpdateRelatedEntitiesInPut);
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:Deserializer.cs

示例4: RESTFulActionConstraint

        /// <summary>
        /// Initializes a new instance of the <see cref="RESTFulActionConstraint"/> class.
        /// </summary>
        /// <param name="httpVerb">The HTTP verb.</param>
        /// <param name="requiresId">if set to <c>true</c> [requires id].</param>
        public RESTFulActionConstraint(HttpVerbs httpVerb, bool requiresId)
        {
            HttpVerbs = httpVerb;
            RequiresId = requiresId;

            verbs = ConvertToStringList(HttpVerbs);
        }
开发者ID:nomit007,项目名称:Core,代码行数:12,代码来源:RESTfulActionConstraint.cs

示例5: Users

        public PartialViewResult Users(HttpVerbs? method, int? page, int? sizePage)
        {
            var model = new ModelTestApiResult();

            // if 'Get'
            if(method == HttpVerbs.Get)
            {
                // start the timer
                var timer = Stopwatch.StartNew();

                // perform the call
                List<UserV2> users;
                var response = LicenceManager.TryListUsers(out users);

                // stop the timer
                timer.Stop();
                model.ElapsedMilliseconds = timer.ElapsedMilliseconds;

                // get the content
                model.Users = users;
                // get the code
                model.ResponseBody = response.GetBodyAsString();
                // get the exception message
                model.Message = response.MessageError;
                // get the status code
                model.StatusCode = response.StatusHttp;
            }
                // if method is not supported
            else
                model.Message = "Method not supported";

            return this.PartialView("Result", model);
        }
开发者ID:ChezMose,项目名称:LicenceToBill.DotNet,代码行数:33,代码来源:TestApiController.cs

示例6: GetRestsharpMethod

        private Method GetRestsharpMethod(HttpVerbs method)
        {
            Method result;

            switch (method)
            {
                case HttpVerbs.Get:
                    result = Method.GET;
                    break;
                case HttpVerbs.Post:
                    result = Method.POST;
                    break;
                case HttpVerbs.Put:
                    result = Method.PUT;
                    break;
                case HttpVerbs.Patch:
                    result = Method.PATCH;
                    break;
                case HttpVerbs.Delete:
                    result = Method.DELETE;
                    break;
                case HttpVerbs.Head:
                    result = Method.HEAD;
                    break;
                default:
                    result = Method.GET;
                    break;
            }

            return result;
        }
开发者ID:JannethAmaya,项目名称:RestAPIClientGenerator,代码行数:31,代码来源:GenericAPICall.cs

示例7: RunPostExecutionFilters

 private static void RunPostExecutionFilters(IAction action, HttpVerbs httpVerb) {
     var filters = GetFilters(action, httpVerb);
     filters.ForEach(x => {
                         x.Context = action.Context;
                         x.AfterExecute();
                     });
 }
开发者ID:szp11,项目名称:Martin,代码行数:7,代码来源:ActionInvoker.cs

示例8: ValidateAntiForgeryTokenWrapperAttribute

 public ValidateAntiForgeryTokenWrapperAttribute(HttpVerbs verbs)
 {
   this._verbs = new AcceptVerbsAttribute(verbs);
   this._validator = new ValidateAntiForgeryTokenAttribute()
   {
     Salt = Consts.AntiForgeryToken
   };
 }
开发者ID:clpereira2001,项目名称:Lelands-Master,代码行数:8,代码来源:ValidateAntiForgeryTokenWrapperAttribute.cs

示例9: ApiDocumentationAttribute

		public ApiDocumentationAttribute( String url, String description = "", Type returnType = null, HttpVerbs requestType = HttpVerbs.Get, Type formBody = null )
		{
			Url = url;
			Description = description;
			ReturnType = returnType;
			RequestType = requestType;
			FormBody = formBody;
		}		
开发者ID:gandarez,项目名称:SwaggerAPIDocumentation,代码行数:8,代码来源:ApiDocumentationAttribute.cs

示例10: ClientPreference

 /// <summary>
 /// Initializes a new instance of the <see cref="ClientPreference"/> class.
 /// </summary>
 /// <param name="requestDescription">The request description.</param>
 /// <param name="verb">The request verb.</param>
 /// <param name="requestMessage">The request message.</param>
 /// <param name="effectiveMaxResponseVersion">The effective max response version for the request, which is the min of MDSV and MPV.</param>
 public ClientPreference(RequestDescription requestDescription, HttpVerbs verb, IODataRequestMessage requestMessage, Version effectiveMaxResponseVersion)
     : this(InterpretClientPreference(requestDescription, verb, requestMessage))
 {
     if (effectiveMaxResponseVersion >= VersionUtil.Version4Dot0)
     {
         this.annotationFilter = requestMessage.PreferHeader().AnnotationFilter;
     }
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:15,代码来源:ClientPreference.cs

示例11: ValidateAntiForgeryTokenWrapperAttribute

 public ValidateAntiForgeryTokenWrapperAttribute(HttpVerbs verbs, string salt)
 {
     this._verbs = new AcceptVerbsAttribute(verbs);
     this._validator = new ValidateAntiForgeryTokenAttribute()
     {
         Salt = salt
     };
 }
开发者ID:ankit-defacto,项目名称:PSS,代码行数:8,代码来源:ValidateAntiForgeryTokenWrapperAttribute.cs

示例12: DoRequest

        public string DoRequest(string query, HttpVerbs method, Action<Stream> data, string contenttype)
        {

            Stream stream = DoDataRequest(query, method, data, contenttype);
            System.IO.StreamReader sr = new StreamReader(stream, Encoding.UTF8);

            return sr.ReadToEnd();
        }
开发者ID:tocsoft,项目名称:Common.Helpers,代码行数:8,代码来源:RestClient.cs

示例13: BuildForm

 public static HtmlTag Form
     (this HtmlHelper html, string actionName, string controllerName, RouteValueDictionary routeValues,
      HttpVerbs method)
 {
     var action = UrlHelper.GenerateUrl
         (null, actionName, controllerName, routeValues, html.RouteCollection,
          html.ViewContext.RequestContext, true);
     return BuildForm(action, method);
 }
开发者ID:ivanbokii,项目名称:Enjoy.Templates,代码行数:9,代码来源:FormExtensions.cs

示例14: CustomValidateAntiForgeryTokenAttribute

        /// <summary>
        /// Initializes a new instance of the <see cref="CustomValidateAntiForgeryTokenAttribute"/> class.
        /// </summary>
        /// <param name="verbs">The verbs.</param>
        /// <param name="salt">The salt.</param>
        public CustomValidateAntiForgeryTokenAttribute(HttpVerbs verbs, string salt)
        {
            Verbs = verbs;
            Salt = salt;

            AcceptVerbsAttribute = new AcceptVerbsAttribute(Verbs);
            Validator = new ValidateAntiForgeryTokenAttribute
            {
                Salt = Salt
            };
        }
开发者ID:iHunt101,项目名称:POS-1,代码行数:16,代码来源:CustomValidateAntiForgeryTokenAttribute.cs

示例15: EnumToArray

        internal static string[] EnumToArray(HttpVerbs verbs) {
            List<string> verbList = new List<string>();

            AddEntryToList(verbs, HttpVerbs.Get, verbList, "GET");
            AddEntryToList(verbs, HttpVerbs.Post, verbList, "POST");
            AddEntryToList(verbs, HttpVerbs.Put, verbList, "PUT");
            AddEntryToList(verbs, HttpVerbs.Delete, verbList, "DELETE");
            AddEntryToList(verbs, HttpVerbs.Head, verbList, "HEAD");

            return verbList.ToArray();
        }
开发者ID:nobled,项目名称:mono,代码行数:11,代码来源:AcceptVerbsAttribute.cs


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