public async Task SendMessage(string message) { int studentId = Context.User.GetUserId(); ChatMessageDTO chatMessage = new ChatMessageDTO() { Message = message, SentOn = DateTime.Now, StudentId = studentId }; StudentDTO student = await _studentService.GetStudentById(studentId); await Clients.All.SendAsync("ReceiveMessage", student.Initials, student.Username, message, Context.User.IsAdministrator()); await _chatMessageService.Add(chatMessage); }