public async Task CreateThreadAndMessage(MessageDetails details) { var userEmail = await _userService.GetCurrentUserEmail(); var recievedBy = _userService.GetUserEmailById(details.RecievedBy.ToString()); var thread = await _threadRepository.AddThread(MessageDetails.FormThread(details, recievedBy), userEmail); await _messageRepository.AddMessage(MessageDetails.FormMessage(details, thread.Id), userEmail); }
public async Task AddMessageToThread(int threadId, MessageDetails details) { var userId = await _userService.GetCurrentUserEmail(); await _messageRepository.AddMessage(MessageDetails.FormMessage(details, threadId), userId); }