Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BootstrapContainer();
- // base binders
- System.Web.Mvc.ModelBinders.Binders.Add(typeof(DateTime), new EOIS.ModelBinders.DateTimeCultureSpecificBinder());
- System.Web.Mvc.ModelBinders.Binders.Add(typeof(DateTime?), new EOIS.ModelBinders.DateTimeCultureSpecificBinder());
- // demand specific binders
- var dSat = container.Resolve<DemandsSanitization>();
- System.Web.Mvc.ModelBinders.Binders.Add(typeof(TelcoDemandViewModel), new EOIS.ModelBinders.TelcoDemandViewModelBinder(dSat));
- System.Web.Mvc.ModelBinders.Binders.Add(typeof(ElectricityDemandViewModel), new EOIS.ModelBinders.ElectricityDemandViewModelBinder(dSat));
- System.Web.Mvc.ModelBinders.Binders.Add(typeof(EnergyDemandViewModel), new EOIS.ModelBinders.EnergyDemandViewModelBinder(dSat));
- System.Web.Mvc.ModelBinders.Binders.Add(typeof(LoanDemandVM), new EOIS.ModelBinders.LoanDemandViewModelBinder(dSat)); var dSat = container.Resolve<DemandsSanitization>();
- System.Web.Mvc.ModelBinders.Binders.Add(typeof(TelcoDemandViewModel), new EOIS.ModelBinders.TelcoDemandViewModelBinder(dSat));
- public class TelcoDemandViewModelBinder : BaseDemandViewModelBinder
- {
- public TelcoDemandViewModelBinder(DemandsSanitization dSanitization) : base(dSanitization) { }
- public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
- {
- var demandVm = (TelcoDemandViewModel) base.BindModel(controllerContext, bindingContext);
- if (demandVm.SimCardsValid != null)
- {
- foreach (var sim in demandVm.SimCardsValid)
- {
- sim.PhoneNumber = DemandsSanitization.SanitizePhoneNumber(sim.PhoneNumber);
- }
- }
- return demandVm;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement