Пример #1
0
 public ActionResult Vehicle(int id)
 {
     string valid = isValid(id);
     if (valid == null)
     {
         return RedirectToAction("Home", "Account");
     }
     estimatevehicle vehicleInfo = _DAOFactory.EstimateVehicleDAO.getById(id);
     if (vehicleInfo == null){
         vehicleInfo = new estimatevehicle();
     }
     //SetVehicleClass(vehicleInfo);
     return View(vehicleInfo);
 }
Пример #2
0
 public ActionResult Vehicle(estimatevehicle vehicleInfo, int id, FormCollection collection)
 {
     string valid = isValid(id);
     if (valid == null)
     {
         return RedirectToAction("Home", "Account");
     }
     if (valid == Permissions.Editor.ToString() || valid == Permissions.Owner.ToString() ||
         valid == Permissions.Admin.ToString())
     {
     }
     return View(vehicleInfo);
 }
Пример #3
0
 public void SetVehicleClass(estimatevehicle vehicle)
 {
     List<vehicletoclass> vtc = new List<vehicletoclass>();
     ViewBag.Makes = new List<SelectListItem>()
     {
         new SelectListItem() {Text = vehicle.make + "(Current)", Value = vehicle.make, Selected = true},
         new SelectListItem() {Text = "None", Value = "None"}
     };
     ViewBag.Models = new List<SelectListItem>()
     {
         new SelectListItem() {Text = vehicle.model + "(Current)", Value = vehicle.model, Selected = true},
         new SelectListItem() {Text = "None", Value = "None"}
     };
     ViewBag.Years = new List<SelectListItem>()
     {
         new SelectListItem()
         {
             Text = vehicle.year.ToString() + "(Current)",
             Value = vehicle.year.ToString(),
             Selected = true
         },
         new SelectListItem() {Text = "None", Value = "None"}
     };
     ViewBag.Classes = new List<SelectListItem>()
     {
         new SelectListItem() {Text = vehicle.vehicleclass + "(Current)", Value = vehicle.vehicleclass, Selected = true},
         new SelectListItem() {Text = "None", Value = "None"}
     };
     foreach (var VTC in _DAOFactory.VehicleToClassDAO.getAllVTC())
     {
         vtc.Add(VTC);
         ViewBag.Makes.Add(new SelectListItem() {Text = VTC.make, Value = VTC.make});
         ViewBag.Models.Add(new SelectListItem() { Text = VTC.model, Value = VTC.model });
         ViewBag.Years.Add(new SelectListItem() {Text = VTC.year.ToString(), Value = VTC.year.ToString()});
     }
     foreach (var classes in _DAOFactory.ClassesDAO.getAllClasses())
     {
         ViewBag.Classes.Add(new SelectListItem() {Text = classes.name, Value = classes.name});
     }
     ViewBag.VTC = vtc;
 }