public ActionResult Create() { var list = carModelRepository.GetList() .Select(x => new SelectListItem { Text = x.CarManufactureTitle + " - " + x.Title, Value = x.ID.ToString() }).ToList(); list.Insert(0, new SelectListItem { Value = "", Text = "انتخاب نمایید" }); ViewBag.ModelList = list; return(View()); }
public JsonResult GetCarModel(int carManufactureID) { var list = carModelRepository.GetList(carManufactureID).Select(x => new SelectListItem { Text = x.Title, Value = x.ID.ToString() }).ToList(); list.Insert(0, new SelectListItem { Value = "", Text = "انتخاب نمایید" }); return(Json(list, JsonRequestBehavior.AllowGet)); }