Base solution for your next web application
Open Closed

Problem in Get Permission List #2175


User avatar
0
razieh69 created

hi, i want to get all parent permissions with childs to create permission tree by jstree.

this is my code in permissionAppService:

public virtual List<PermissionListDto> GetAllPermissionList()
{
 var permissions = _permissionManager.GetAllPermissions(true).Where(a=>a.Parent==null).ToList();
            return permissions.MapTo<List<PermissionListDto>>();
}

and my PermissionListDto:

[AutoMapFrom(typeof(Permission))]
    public class PermissionListDto 
    {
        public virtual ICollection<PermissionListDto> Children { get; }
        public virtual string Description { get; set; }
       public virtual string DisplayName { get; set; }
        public virtual string Name { get; set; }

        public virtual string Text { get; set; }

        public virtual PermissionListDto Parent { get; set; }
    }

but when i call my function in javacsript, i get this error in browser console:

There is an action GetAllPermissionList defined for api controller app/permission but with a different HTTP Verb. Request verb is GET. It should be Post

i think that, automap from IReadonlylist to ICollection (for childrens) is the problem, but i dont khnow how to solve it. please help me, :cry:


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Let's continue here #2178