//private IConversationRepo _conversationRepo; public async Task GlobalSend(string username, string message) { using (_conversationReplyRepo = new ConversationReplyRepo(_ctx)) { using (_userRepo = new UserRepo(_ctx)) { var dateTime = DateTime.Now; _conversationReplyRepo.Add(new ConversationReply() { UserId = username, Sent = dateTime, Text = message, ConversationId = "Global" }); await _conversationReplyRepo.SaveChangesAsync(); Clients.All.globalSend(username, message, dateTime.ToString("dd.MM.yyyy HH:mm:ss")); } } }
public ChatController(IUserRepo userRepo, IConversationReplyRepo conversationReplyRepo, IFriendRepo friendRepo) { _userRepo = userRepo; _conversationReplyRepo = conversationReplyRepo; _friendRepo = friendRepo; }