Exemplo n.º 1
0
        public JsonResult GetCarYear(int carModelID)
        {
            var list = carYearRepository.GetList(carModelID).Select(x => new SelectListItem
            {
                Text  = x.Year.ToString(),
                Value = x.ID.ToString()
            }).ToList();

            list.Insert(0, new SelectListItem {
                Value = "", Text = "انتخاب نمایید"
            });

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            var item = repository.GetItem(id);

            ViewBag.ModelList = carModelRepository.GetList()
                                .Select(x => new SelectListItem
            {
                Text  = x.CarManufactureTitle + " - " + x.Title,
                Value = x.ID.ToString()
            }).ToList();
            ViewBag.YearList = carYearRepository.GetList(item.CarModelID).Select(x => new SelectListItem
            {
                Text  = x.Year.ToString(),
                Value = x.ID.ToString()
            }).ToList();
            ViewBag.DetailList = carDetailRepository.GetList(item.CarModelID)
                                 .Select(x => new SelectListItem
            {
                Text  = x.Title.ToString(),
                Value = x.ID.ToString()
            }).ToList();
            return(View(item));
        }