本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例7: CreateModel
protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext,
Type modelType)
{
string type = controllerContext.GetValueFromRequest("ApplicationType");
return Activator.CreateInstance(TypeHelper.GetTypeByName(type));
}