Exemplo n.º 1
0
        public static LookupViewModel GetModel(IDataContext context)
        {
            var model = new LookupViewModel()
            {
                Configuration = context.ConfigurationSettings
            };

            model.AvailableVehicles = context.Vehicle.ListAvailableVehicles(new VehicleFilter());
            model.Makes             = model.ListMakes();
            model.Programmes        = model.ListProgrammes();
            model.ModelYears        = model.ListModelYears();
            model.Gateways          = model.ListGateways();
            model.TrimLevels        = model.ListTrimLevels();

            return(model);
        }
Exemplo n.º 2
0
        private static LookupViewModel GetLookup(IDataContext context, IVehicle forVehicle)
        {
            LookupViewModel lookup       = null;
            var             cacheKey     = string.Format("ProgrammeLookup_{0}", forVehicle.GetHashCode());
            var             cachedLookup = HttpContext.Current.Cache.Get(cacheKey);

            if (cachedLookup != null)
            {
                lookup = (LookupViewModel)cachedLookup;
            }
            else
            {
                lookup = LookupViewModel.GetModelForVehicle(forVehicle, context);
                HttpContext.Current.Cache.Add(cacheKey, lookup, null, DateTime.Now.AddMinutes(60), Cache.NoSlidingExpiration, CacheItemPriority.Default, null);
            }
            return(lookup);
        }
        public static LookupViewModel GetModel(IDataContext context)
        {
            var model = new LookupViewModel()
            {
                Configuration = context.ConfigurationSettings
            };

            model.AvailableVehicles = context.Vehicle.ListAvailableVehicles(new VehicleFilter());
            model.Makes = model.ListMakes();
            model.Programmes = model.ListProgrammes();
            model.ModelYears = model.ListModelYears();
            model.Gateways = model.ListGateways();
            model.TrimLevels = model.ListTrimLevels();

            return model;
        }