/// <summary> /// 根据Id获取 /// </summary> /// <param name="id"></param> /// <returns></returns> public IEnumerable <RightsView> GetRightsIsLeafView(int id) { RightsView model = this.GetRights(id).ConvertToRightsView(); if (model == null) { throw new EntityIsInvalidException <string>(id.ToString()); } return(ForeachChild(model, true)); }
/// <summary>修改组织 /// 修改组织 /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="description"></param> /// <returns></returns> public JsonResult UpdateRights(int id, string name, string url, string description, string isshow) { bool show = false; if (isshow == "1") { show = true; } RightsView rights = this._rightsService.UpdateRights(id, name, url, description, show); return(Json(rights, JsonRequestBehavior.AllowGet)); }
public JsonResult AddRightsChild(string id, string name, string url, string description, string isshow) { bool show = false; if (isshow == "1") { show = true; } RightsView rights = this._rightsService.AddRightsChild(Convert.ToInt32(id), name, url, description, show); return(Json(rights, JsonRequestBehavior.AllowGet)); }
private IList <RightsView> ForeachChild(RightsView model, bool isleaf) { IList <RightsView> reslut = new List <RightsView>(); foreach (RightsView item in model.Child) { if (item.IsLeaf) { reslut.Add(item); } else { IList <RightsView> child = ForeachChild(item, isleaf); foreach (RightsView childitem in child) { reslut.Add(childitem); } } } return(reslut); }
/// <summary>修改组织 /// 修改组织 /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="description"></param> /// <returns></returns> public JsonResult UpdateRights(AddRightsRequest request) { RightsView rights = this._rightsService.UpdateRights(request); return(Json(rights, JsonRequestBehavior.AllowGet)); }
public JsonResult AddRightsChild(string id, string name, string url, string description, string isshow) { RightsView rights = this._rightsService.AddRights(null); return(Json(rights, JsonRequestBehavior.AllowGet)); }
/// <summary>获取权限列表 /// </summary> /// <returns></returns> public JsonResult GetRights() { RightsView rights = this._rightsService.GetRightsView(0); return(Json(rights, JsonRequestBehavior.AllowGet)); }
public HttpResponseMessage UpdateRights([FromUri] AddRightsRequest request) { RightsView rights = this._rightsService.UpdateRights(request); return(ToJson(rights)); }
public HttpResponseMessage GetRightsView(int id) { RightsView rights = this._rightsService.GetRightsView(id); return(ToJson(rights)); }