public IEnumerable <AccountDTO> GetAccountsByTeg(string teg, string token) { IMainMap map = new Map(); List <AccountDTO> accounts = new List <AccountDTO>(); IEnumerable <User> users; if (teg == null) { using (UserRepository repository = new UserRepository()) { users = repository.GetItemListWithoutUser(map.AccountModelToUser(UsersData.UserList.Accounts[token])); } } else { using (UserRepository repository = new UserRepository()) { users = repository.GetUsersByString(teg, token); } } IMapUser accountmap = new Map(); foreach (User user in users) { accounts.Add(accountmap.UserToAccountDTO(user)); } return(accounts); }
public IEnumerable <GroupChatDTO> GetChats(string token) { List <GroupChatDTO> chatDTOs = new List <GroupChatDTO>(); IEnumerable <Chat> groupChats; IMapUser userMap = new Map(); IMainMap mainMap = new Map(); using (ChatRepository repository = new ChatRepository()) { groupChats = repository.GetGroupChats(userMap.AccountModelToUser(UsersData.UserList.Accounts[token])); } foreach (Chat chat in groupChats) { chatDTOs.Add(mainMap.ChatToGroupChatDTO(chat)); } return(chatDTOs); }