Exemplo n.º 1
0
        public List <RolePermission> AddRolePermission(RolePermissionViewModel userRole)
        {
            var userRoles = new List <RolePermission>();

            foreach (var item in userRole.PerIds)
            {
                var data = new RolePermission();
                data.PerId  = item;
                data.RoleId = userRole.RoleId;
                userRoles.Add(data);
            }
            _rolePermission.AddRange(userRoles);
            SaveChanges();
            return(userRoles);
        }