// GET: Admin/Car public ActionResult Index() { List <Color> colorList = new List <Color>(); colorList = _colorBusiness.GetAll(); SelectList colorListSelect = new SelectList(colorList, "ID", "Name"); ViewBag.Color = colorListSelect; List <Brand> brandList = new List <Brand>(); brandList = _brandBusiness.GetAll(); SelectList brandListSelect = new SelectList(brandList, "ID", "Name"); ViewBag.Brand = brandListSelect; List <Model> modelList = new List <Model>(); modelList = _modelBusiness.GetAll(); SelectList modelListSelect = new SelectList(modelList, "ID", "Name"); ViewBag.Model = modelListSelect; return(View()); }
public JsonResult List() { List <Brand> brandList = new List <Brand>(); try { brandList = _brandBll.GetAll(); } catch (Exception ex) { return(Json(ex, JsonRequestBehavior.AllowGet)); } List <BrandVM> brandVMList = new List <BrandVM>(); foreach (var item in brandList) { BrandVM brandVm = new BrandVM(); brandVm.ID = item.ID; brandVm.Name = item.Name; brandVMList.Add(brandVm); } return(Json(brandVMList, JsonRequestBehavior.AllowGet)); }
public JsonResult Add(Model model) { try { List <Brand> brands = _brandbussiness.GetAll(); SelectList brandList = new SelectList(brands, "ID", "Name"); ViewBag.List = brandList; _modelbusiness.Add(model); return(Json("İşlem başarılı", JsonRequestBehavior.AllowGet)); } catch (Exception ex) { throw ex; } }