/// <summary> /// Get specific chat /// </summary> /// <param name="id"></param> /// <returns>ChatDTO</returns> public ChatDTO GetChatById(int id) { Logger.log.Debug("at WCFService.ChatService.GetChatById"); var chat = ChatProvider.GetChatById(id); return(_chatConverter.ToDataTransferEntity(chat)); }
/// <summary> /// Get all messages from this chat /// </summary> /// <param name="id"></param> /// <returns>List of messages</returns> public IList <MessageDTO> GetAllMessagesFromChat(int id) { Logger.log.Debug("at WCFService.ChatService.GetAllMessagesFromChat"); var chat = ChatProvider.GetChatById(id); var messages = ChatProvider.GetMessagesFromChat(chat); return(_messageConverter.ToDataTransferEntityList(messages.ToList())); }
/// <summary> /// Get all users from this chat /// </summary> /// <param name="id"></param> /// <returns>List of users</returns> public IList <UserInfoDTO> GetAllUsersFromChat(int id) { Logger.log.Debug("at WCFService.ChatService.GetAllUsersFromChat"); var chat = ChatProvider.GetChatById(id); var users = ChatProvider.GetUsersOfChat(chat); return(_userConverter.ToDataTransferEntityList(users.ToList())); }
/// <summary> /// Add user to chat /// </summary> /// <param name="chatId"></param> /// <param name="userId"></param> /// <returns>Result of opreation</returns> public bool AddUser(int chatId, int userId) { Logger.log.Debug("at WCFService.ChatService.AddUser"); var user = new User() { Id = userId }; var chat = ChatProvider.GetChatById(chatId); return(ChatProvider.AddUserToChat(user, chat)); }
static void Main(string[] args) { //UserProvider usrPrv = new UserProvider(); //var user = usrPrv.GetUserById(1); //var user2 = usrPrv.GetUserById(5); //var way = usrPrv.GetWayBetweenFriends(user, user2); //Console.WriteLine("{0},{1},{2}",way[0].FirstName, // way[1].FirstName, // way[2].FirstName); ChatProvider c = new ChatProvider(); UserProvider u = new UserProvider(); var user = u.GetUserById(2); var chat = c.GetChatById(3); c.AddUserToChat(user, chat); Console.ReadLine(); }
public static void IsGetChatByIdWorks() { Chat chat = chatPrv.GetChatById(1); Assert.That(chat.Title == "Chatik"); }