예제 #1
0
        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());
        }
예제 #2
0
        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));
        }