Advertisement
Guest User

Untitled

a guest
Dec 12th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. public List<IdpTeamResponse> AddIdpTeamsBackoffice(List<IdpTeamRequest> idpTeams, string userLogin)
  2.         {
  3.             if (!Can(AccessRight.Add, userLogin, typeof(IdpTeam)))
  4.                 throw new UnauthorizedAccessException();        
  5. ...............................
  6.             dataManager.Save();
  7.             var result = TestMain<IdpTeam, IdpTeamResponse>(dbIdpTeams, dataManager.IdpTeam);
  8.             return result;
  9.         }
  10.  
  11.         private List<TResult> TestMain<TBase, TResult>(List<TBase> list, IRepository<TBase> repository) where TBase : class, IEntity
  12.         {
  13.             var listIds = list.Select(x => x.Id);
  14.             var newList = repository.GetAll().Where(x => listIds.Contains(x.Id)).ToList();
  15.             var result = Mapper.Map<List<TBase>, List<TResult>>(newList);
  16.             return result;
  17.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement