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


C# ControllerContext.GetValueFromRequest方法代码示例

本文整理汇总了C#中System.Web.Mvc.ControllerContext.GetValueFromRequest方法的典型用法代码示例。如果您正苦于以下问题:C# ControllerContext.GetValueFromRequest方法的具体用法?C# ControllerContext.GetValueFromRequest怎么用?C# ControllerContext.GetValueFromRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Mvc.ControllerContext的用法示例。


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

示例1: BindModel

        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var user = base.BindModel(controllerContext, bindingContext) as User;

            _passwordManagementService.SetPassword(user,
                                                   controllerContext.GetValueFromRequest("Password"),
                                                   controllerContext.GetValueFromRequest("ConfirmPassword"));

            return user;
        }
开发者ID:neozhu,项目名称:MrCMS,代码行数:10,代码来源:AddUserModelBinder.cs

示例2: BindModel

 public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
 {
     var document = base.BindModel(controllerContext, bindingContext) as Document;
     string taglist = controllerContext.GetValueFromRequest("TagList") ?? string.Empty;
     DocumentTagsAdminService.SetTags(taglist, document);
     return document;
 }
开发者ID:neozhu,项目名称:MrCMS,代码行数:7,代码来源:WebpageModelBinder.cs

示例3: BindModel

        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var bindModel = base.BindModel(controllerContext, bindingContext);
            if (bindModel is ProductVariant)
            {
                var productVariant = bindModel as ProductVariant;

                var variantType = controllerContext.GetValueFromRequest("VariantType");
                _setVariantTypeProperties.SetProperties(productVariant, variantType);
                _setRestrictedShippingMethods.SetMethods(productVariant, controllerContext.HttpContext.Request.Params);

                var eTag = 0;
                Int32.TryParse(controllerContext.GetValueFromRequest("ETag"), out eTag);
                if(eTag > 0)
                    _setETagService.SetETag(productVariant, eTag);
            }
            return bindModel;
        }
开发者ID:neozhu,项目名称:Ecommerce,代码行数:18,代码来源:ProductVariantModelBinder.cs

示例4: BindModel

 public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
 {
     var idKeys = controllerContext.HttpContext.Request.Form.AllKeys.Where(s => s.StartsWith("id-"));
     var productSortDatas = new List<ProductSortData>();
     foreach (var idKey in idKeys)
     {
         var idVal = controllerContext.GetValueFromRequest(idKey);
         var orderVal = controllerContext.GetValueFromRequest("order-" + idKey.Substring(3));
         int id, order;
         if (int.TryParse(idVal, out id) && int.TryParse(orderVal, out order))
         {
             productSortDatas.Add(new ProductSortData
             {
                 Id = id,
                 DisplayOrder = order
             });
         }
     }
     return productSortDatas;
 }
开发者ID:neozhu,项目名称:Ecommerce,代码行数:20,代码来源:ProductSortDataModelBinder.cs

示例5: BindModel

        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var calculation = base.BindModel(controllerContext, bindingContext) as CountryBasedShippingCalculation;

            if (calculation == null)
                return null;

            IEnumerable<string> countryKeys =
                controllerContext.HttpContext.Request.Form.AllKeys.Where(key => key.StartsWith("country-"));

            List<string> codes =
                (from key in countryKeys
                 where controllerContext.GetValueFromRequest(key).Contains("true", StringComparison.InvariantCultureIgnoreCase)
                 select key.Split('-')[1]).ToList();

            calculation.Countries = string.Join(",", codes);
            return calculation;
        }
开发者ID:neozhu,项目名称:Ecommerce,代码行数:18,代码来源:CountryBasedShippingCalculationModelBinder.cs

示例6: CreateModel

 protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType)
 {
     var discountType = controllerContext.GetValueFromRequest("DiscountType");
     var type = TypeHelper.GetTypeByName(discountType);
     return Activator.CreateInstance(type);
 }
开发者ID:neozhu,项目名称:Ecommerce,代码行数:6,代码来源:AddDiscountModelBinder.cs

示例7: CreateModel

 protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext,
     Type modelType)
 {
     string type = controllerContext.GetValueFromRequest("ApplicationType");
     return Activator.CreateInstance(TypeHelper.GetTypeByName(type));
 }
开发者ID:neozhu,项目名称:Ecommerce,代码行数:6,代码来源:AddDiscountApplicationModelBinder.cs


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