コード例 #1
0
        public void VehicleModelFileHasData()
        {
            var dataFile = _path + @"/modelsbymake.xml";
            var models   = MakesModels.GetVehicleModels(dataFile);

            Assert.IsNotNull(models, "Data file of vehicle model should has data");
        }
コード例 #2
0
        public void VehicleMakeFileHasData()
        {
            var dataFile = _path + @"/makes.xml";
            var makes    = MakesModels.GetVehicleMakes(dataFile);

            Assert.IsNotNull(makes, "Data file of vehicle make should has data");
        }
コード例 #3
0
        public List <VehicleModel> GetVehicleModelByMakeID(int makeID)
        {
            if (makeID > 0)
            {
                _models = MakesModels.GetVehicleModels(_path + @"/modelsbymake.xml");
                return(_models.Where(m => m.MakeID == makeID).ToList());
            }

            return(new List <VehicleModel>());
        }
コード例 #4
0
        public ActionResult RenderForm()
        {
            string  strMakes      = ConfigurationManager.AppSettings["fileMakes"];
            string  strModels     = ConfigurationManager.AppSettings["fileModels"];
            string  xmlMakesPath  = Server.MapPath("~/App_Data/" + strMakes);
            string  xmlModelsPath = Server.MapPath("~/App_Data/" + strModels);
            MyModel model         = new MyModel();

            try
            {
                model.lstMakes  = MakesModels.getMakes(xmlMakesPath);
                model.lstModels = MakesModels.getMakeModels(xmlModelsPath);
            }
            catch (Exception e)
            {
                return(View("Error"));
            }

            return(PartialView("_Form", model));
        }
コード例 #5
0
 public List <VehicleMake> GetVehicleMakes()
 {
     _makes = MakesModels.GetVehicleMakes(_path + @"/makes.xml");
     return(_makes);
 }