public _requestTypes olustur(int rt_id) { var item = db.RequestTypes.Find(rt_id); _requestTypes _requests = new _requestTypes(); _requests.Text = item.Description; _requests.Value = item.RequestTypeID.ToString(); _requests.Expanded = true; if (db.RequestTypes.Where(e => e.ParentRequestTypeId == rt_id).Count() > 0) { var sbz = db.RequestTypes.Where(e => e.ParentRequestTypeId == rt_id).ToList(); foreach (var it in sbz) { _requests.Items.Add(olustur(it.RequestTypeID)); } } return _requests; }
public ActionResult GetJsonTree(string ms) { _requestTypes _requests = new _requestTypes(); var rt_list = db.RequestTypes.Where(e => e.ParentRequestTypeId == null).ToList(); foreach (var item in rt_list) { _requests.Items.Add(olustur(item.RequestTypeID)); } return Json(_requests, JsonRequestBehavior.AllowGet); }