public void SearchUser(string searchBy) { if (searchBy != "") { List <UserDTO> userList = new List <UserDTO>(); foreach (var item in client.GetAllUsers()) { if (item.Name.Contains(searchBy)) { userList.Add(item); } } AllUsers = userList; } else { AllUsers = client.GetAllUsers(); } }
public MainMenuViewModel(UserDTO current) { CurrentUser = current; client = new ZaolisServiceClient.ZaolisServiceClient(new System.ServiceModel.InstanceContext(handler)); AllUsers = client.GetAllUsers(); FriendUsers = client.GetContacts(CurrentUser); ChatInfos = new ObservableCollection <ChatInfoModel>(); if (client.GetUserChats(CurrentUser) != null) { Chats = new ObservableCollection <ChatDTO>(client.GetUserChats(CurrentUser)); foreach (var chat in Chats) { ChatInfos.Add(new ChatInfoModel(client, CurrentUser, chat)); } } //CurrentAvatar = client.GetAvatar(CurrentUser); }