public IActionResult GetPermissions(string roleId) { if (roleId == "new") { roleId = string.Empty; } var candidateDtos = _pr.GetPermissionCandidates(roleId); var selectedDtos = _rpr.GetRolePermissions(roleId); var vm = new PermissionSelectionApiViewModel() { PermissionSelected = _mapper.Map <IEnumerable <SelectedPermissionApiViewModel> >(selectedDtos), PermissionCandidates = _mapper.Map <IEnumerable <PermissionApiViewModel> >(candidateDtos) }; return(Ok(new ApiResultModel <PermissionSelectionApiViewModel> { Data = vm })); }