public ActionResult Add() { List <SelectListItem> roleSelectList = new List <SelectListItem>(); (_rolebusiness.GetList() as List <RoleModel>). ForEach(r => roleSelectList.Add(new SelectListItem { Text = r.Name, Value = r.Id.ToString() } )); ViewBag.Rolelist = roleSelectList; return(View()); }
public JsonResult GetList() { var list = _business.GetList(); return(Json(list, JsonRequestBehavior.AllowGet)); }