Ejemplo n.º 1
0
 public async Task <IEnumerable <User> > GetAsync(UserSearchRequest request)
 {
     if (request is UserSearchFilterRequest filterRequest)
     {
         return(await GetFilteredUsersAsync(filterRequest));
     }
     else
     {
         return(await GetAllCompanyUsersAsync(request));
     }
 }
Ejemplo n.º 2
0
        private async Task <IEnumerable <User> > GetAllCompanyUsersAsync(UserSearchRequest request)
        {
            var users = new List <User>();

            using var conn = await base.GetConnectionAsync();

            using var cmd   = conn.CreateCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "sp_UserList";
            cmd.Parameters.Add(BuildParameter("@CompanyId", request.CompanyId));
            using var rdr = cmd.ExecuteReader();
            while (rdr.Read())
            {
                var user = GetUser(rdr);
                users.Add(user);
            }

            return(users);
        }
Ejemplo n.º 3
0
 public Task <IEnumerable <User> > GetAsync(UserSearchRequest request)
 {
     return(Task.FromResult <IEnumerable <User> >(users));
 }