async Task <IEnumerable <UserModel> > IUsersRepository.GetUsers(UserModelFilter filter)
        {
            using var context = GetContext();
            var users = context.Users.Include(u => u.Roles).AsQueryable().AsNoTracking();

            var result = users.Where(r =>
                                     (string.IsNullOrEmpty(filter.UserLogin) || r.Login.Equals(filter.UserLogin)) &&
                                     (!filter.UserId.HasValue || r.Id.Equals(filter.UserId.Value)) &&
                                     (!filter.DealerId.HasValue || (r.Dealer != null && r.Dealer.Id.Equals(filter.DealerId.Value)))
                                     );

            return(await result.ToListAsync());
        }
        public async Task <IActionResult> GetUsers(UserModelFilter userModelFilter)
        {
            var result = await _usersRepository.GetUsers(userModelFilter);

            return(Ok(_mapper.Map <IEnumerable <UserListModel> >(result)));
        }