Example #1
0
        public HomeController(ICategoryRepo catRepo, IModelRepo modelRepo)
        {
            _categoryRepository = catRepo;
            _modelRepository = modelRepo;

            //_productRepository = prodRepo;
            //_itemRepository = iteRepo;
        }
 public VehicleController(IMakesRepo makesRepo,
                          IVehicleRepo vehicleRepo,
                          IModelRepo modelRepo,
                          IOwnerRepo ownereRepo
                          )
 {
     this._makesRepo   = makesRepo;
     this._vehicleRepo = vehicleRepo;
     this._modelRepo   = modelRepo;
     this._ownereRepo  = ownereRepo;
 }
        public IEnumerable <Vehicle> Search(string type, string term, decimal minPrice, decimal maxPrice, int minYear, int maxYear)
        {
            IModelRepo            modelRepo = Factory.GetModelRepo();
            IMakeRepo             makeRepo  = Factory.GetMakeRepo();
            IEnumerable <Vehicle> vehicles  = new List <Vehicle>();

            switch (type)
            {
            case "new":
                vehicles = GetAll().Where(v => v.Type == "New");
                break;

            case "used":
                vehicles = GetAll().Where(v => v.Type == "Used");
                break;

            case "all":
                vehicles = GetAll().Where(v => v.Type != "Sold");
                break;

            default:
                break;
            }
            List <Vehicle> found = new List <Vehicle>();

            //validated here so we don't pass in another parameter
            int year = 0;

            int.TryParse(term, out year);

            foreach (var vehicle in vehicles)
            {
                vehicle.Make  = makeRepo.GetById(vehicle.MakeId);
                vehicle.Model = modelRepo.GetById(vehicle.ModelId);

                if (vehicle.Year >= minYear && vehicle.Year <= maxYear && vehicle.SalePrice >= minPrice && vehicle.SalePrice <= maxPrice)
                {
                    if (term != "hamster")
                    {
                        if (vehicle.Year == year || vehicle.Make.MakeName.ToLower().Contains(term.ToLower()) || vehicle.Model.ModelName.ToLower().Contains(term.ToLower()))
                        {
                            found.Add(vehicle);
                        }
                    }
                    else
                    {
                        found.Add(vehicle);
                    }
                }
            }

            vehicles = found;
            return(vehicles);
        }
 public DummyController(IDummyModelProcessor processor, IModelRepo repo)
 {
     if (processor == null)
     {
         throw new ArgumentNullException(nameof(processor));
     }
     if (repo == null)
     {
         throw new ArgumentNullException(nameof(repo));
     }
     _processor = processor;
     _repo      = repo;
 }
Example #5
0
 public PipelineModuleManager(IListenerConfigurationRepo listenerConfigurationRep, ISecureStorage secureStorage, IInputTranslatorConfigurationRepo inputConfigurationRepo, ISentinelConfigurationRepo sentinalConfigurationRepo, IPlannerConfigurationRepo plannerConfigurationRepo,
                              IModelRepo modelRepo, IOutputTranslatorConfigurationRepo outputConfigurationRepo, ITransmitterConfigurationRepo translatorConfigurationRepo, ICustomPipelineConfigurationRepo pipelineConfigrationRepo, IAdminLogger logger, IAppConfig appConfig,
                              IDependencyManager depManager, ISecurity security) : base(logger, appConfig, depManager, security)
 {
     _listenerConfigurationRepo         = listenerConfigurationRep;
     _inputTranslatorConfigurationRepo  = inputConfigurationRepo;
     _sentinalConfigurationRepo         = sentinalConfigurationRepo;
     _outputTranslatorConfigurationRepo = outputConfigurationRepo;
     _transmitterConfigurationRepo      = translatorConfigurationRepo;
     _customPipelineConfigurationRepo   = pipelineConfigrationRepo;
     _plannerConfigurationRepo          = plannerConfigurationRepo;
     _secureStorage = secureStorage;
     _modelRepo     = modelRepo;
 }
Example #6
0
 public ModelController(IModelRepo repo)
 {
     _repo = repo;
 }
Example #7
0
 public ModelManager(IModelRepo modelRepo, IMLModelRepo mlModelRepo, ILogger logger, IAppConfig appConfig, IDependencyManager dependencyManager, ISecurity security)
     : base(logger, appConfig, dependencyManager, security)
 {
     this._repo      = modelRepo;
     this._modelRepo = mlModelRepo;
 }