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)); } }
public ActionResult AddMake() { MakeVM makeVM = new MakeVM(); var repo = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo(); makeVM.Makes = repo.GetAllMakes(); return(View(makeVM)); }
public ActionResult AddModel() { ModelVM modelVM = new ModelVM(); var repo = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo(); modelVM.Makes = GetMakeSelectList(); modelVM.Models = repo.GetAllModels(); return(View(modelVM)); }
private List <SelectListItem> GetTransmissionSelectList() { var repo = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo(); return((from type in repo.GetAllTransmissions() select new SelectListItem() { Text = type.TransmissionType, Value = type.TransmissionType, }).ToList()); }
private List <SelectListItem> GetModelSelectList() { var repo = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo(); return((from type in repo.GetAllModels() select new SelectListItem() { Text = type.ModelName, Value = type.ModelName, }).ToList()); }
private List <SelectListItem> GetInteriorsSelectList() { var repo = VehicleComponentsRepoFactory.CreateVehicleComponentsRepo(); return((from type in repo.GetAllInteriors() select new SelectListItem() { Text = type.InteriorType, Value = type.InteriorType, }).ToList()); }
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)); } }