/// <summary> /// 修改某一项角色权限 /// </summary> /// <param name="data"></param> public void ModifyRoleRight(RoleRight data) { if (data == null) { throw new Exception("角色权限不能为空。"); } this.Entry <RoleRight>(data).State = System.Data.EntityState.Modified; }
/// <summary> /// 删除一个角色权限 /// </summary> /// <param name="data"></param> public void DeleteRoleRight(RoleRight data) { if (data == null) { throw new Exception("角色权限不能为空。"); } //this.Set<RoleRight>().Remove(data); this.Entry <RoleRight>(data).State = System.Data.EntityState.Deleted; }
/// <summary> /// 给角色增加一个权限,重新生成唯一标识 /// </summary> /// <param name="data"></param> /// <returns></returns> public RoleRight AddRoleRight(RoleRight data) { if (data == null) { throw new Exception("角色权限信息不能为空。"); } //data.RoleID = System.Guid.NewGuid().ToString(); this.Set <RoleRight>().Add(data); return(data); }