예제 #1
0
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);

            // ToDo: check if shamsi then do the conversion.
            var date = (DateTime)value.ConvertTo(typeof(DateTime), CultureInfo.CurrentCulture);

            date = PersianCulture.PersianToGregorianUS(date);

            return(date);
        }
예제 #2
0
            public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
            {
                var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);

                if ((value != null) && (!string.IsNullOrWhiteSpace(value.AttemptedValue.Trim())))
                {
                    var date = (DateTime)value.ConvertTo(typeof(DateTime), CultureInfo.CurrentCulture);
                    date = PersianCulture.PersianToGregorianUS(date);

                    return(date);
                }
                return(null);
            }