Пример #1
0
        public ActionResult AddModel(ModelVM modelVM)
        {
            var repo = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo();

            if (ModelState.IsValid)
            {
                modelVM.ModelToADO = new Model();

                modelVM.ModelToADO.ModelName = modelVM.NameOfNewModel;
                modelVM.ModelToADO.MakeName  = modelVM.MakeName;

                //fake work-around until security is in place
                modelVM.ModelToADO.UserName = "******";

                repo.InsertModel(modelVM.ModelToADO);

                return(RedirectToAction("AddModel", "Admin"));
            }
            else
            {
                modelVM.Makes  = GetMakeSelectList();
                modelVM.Models = repo.GetAllModels();

                return(View(modelVM));
            }
        }
Пример #2
0
        public ActionResult AddMake()
        {
            MakeVM makeVM = new MakeVM();
            var    repo   = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo();

            makeVM.Makes = repo.GetAllMakes();

            return(View(makeVM));
        }
Пример #3
0
        public ActionResult AddModel()
        {
            ModelVM modelVM = new ModelVM();
            var     repo    = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo();

            modelVM.Makes  = GetMakeSelectList();
            modelVM.Models = repo.GetAllModels();

            return(View(modelVM));
        }
Пример #4
0
        private List <SelectListItem> GetTransmissionSelectList()
        {
            var repo = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo();

            return((from type in repo.GetAllTransmissions()
                    select new SelectListItem()
            {
                Text = type.TransmissionType,
                Value = type.TransmissionType,
            }).ToList());
        }
Пример #5
0
        private List <SelectListItem> GetModelSelectList()
        {
            var repo = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo();

            return((from type in repo.GetAllModels()
                    select new SelectListItem()
            {
                Text = type.ModelName,
                Value = type.ModelName,
            }).ToList());
        }
Пример #6
0
        private List <SelectListItem> GetInteriorsSelectList()
        {
            var repo = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo();

            return((from type in repo.GetAllInteriors()
                    select new SelectListItem()
            {
                Text = type.InteriorType,
                Value = type.InteriorType,
            }).ToList());
        }
Пример #7
0
        public ActionResult AddMake(MakeVM makeVM)
        {
            var repo = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo();

            if (ModelState.IsValid)
            {
                makeVM.MakeToADO = new Make();

                makeVM.MakeToADO.MakeName = makeVM.NameOfNewMake;

                //fake work-around until security is in place
                makeVM.MakeToADO.UserName = "******";

                repo.InsertMake(makeVM.MakeToADO);
                return(RedirectToAction("AddMake", "Admin"));
            }
            else
            {
                makeVM.Makes = repo.GetAllMakes();
                return(View(makeVM));
            }
        }