Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
        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;
        }
 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;
 }
        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;
        }
Exemplo n.º 6
0
 protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType)
 {
     var discountType = controllerContext.GetValueFromRequest("DiscountType");
     var type = TypeHelper.GetTypeByName(discountType);
     return Activator.CreateInstance(type);
 }
 protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext,
     Type modelType)
 {
     string type = controllerContext.GetValueFromRequest("ApplicationType");
     return Activator.CreateInstance(TypeHelper.GetTypeByName(type));
 }