public void SendMessageAllFriends(Profile profile, string message) { IProfileIterator iterator = _socialNetwork.ViewFriendsIterator(profile); var profileFriend = iterator.GetNext(); while (profileFriend != null) { GerenciadorSaida.SaidaConsole.EscreverTexto($"Id: {profileFriend.Id}\tNome Friend: {profileFriend.Name}\tMensagem: {message}"); profileFriend = iterator.GetNext(); } }
public void Send(IProfileIterator iterator, string message) { var profile = iterator.GetNext(); SendEmail(profile.GetEmail(), message); while (iterator.HasMore()) { profile = iterator.GetNext(); SendEmail(profile.GetEmail(), message); } }