public async Task <IEnumerable <UserDto> > GetUsersByCompanyIdAsync(int id)
        {
            var company = await Uow.Companies.GetByIdAsync(id);

            if (company == null)
            {
                throw new ArgumentException($"Could not found company with id: '{id}'", nameof(id));
            }

            var users = await Uow.Users.WhereAsync(x => x.CompanyId == id);

            return(users.Any()
                ? _userConverter.ToUserDtos(users)
                : new List <UserDto>());
        }
Beispiel #2
0
 public async Task <IEnumerable <UserDto> > GetAllAsync() =>
 _userConverter.ToUserDtos(await Uow.Users.GetAllAsync());