BLL.Computer.SearchComputersForUser C# (CSharp) Method

SearchComputersForUser() public static method

public static SearchComputersForUser ( int userId, int limit, string searchString = "" ) : List
userId int
limit int
searchString string
return List
        public static List<Models.Computer> SearchComputersForUser(int userId,int limit, string searchString = "")
        {
            if(BLL.User.GetUser(userId).Membership == "Administrator")
                return SearchComputers(searchString,limit);

            var listOfComputers = new List<Models.Computer>();

            var userManagedGroups = BLL.UserGroupManagement.Get(userId);
            if (userManagedGroups.Count == 0)
                return SearchComputers(searchString,limit);
            else
            {
                foreach (var managedGroup in userManagedGroups)
                {
                    listOfComputers.AddRange(BLL.Group.GetGroupMembers(managedGroup.GroupId, searchString));
                }

                foreach (var computer in listOfComputers)
                    computer.Image = BLL.Image.GetImage(computer.ImageId);

                return listOfComputers;
            }
        }