public ActionResult AddMessage(string Text) { Message message = new Message { sent = DateTime.Now, sender = User.Identity.GetUserId(), text = Text }; db.AddMessage(message); return(new HttpStatusCodeResult(HttpStatusCode.OK)); }
public void SendToUser(int chatId, string to, string message) { var senderName = Context.User.Identity.Name; Message newMessage = new Message { sent = DateTime.Now, ChatId = chatId, sender = senderName, text = message }; db.AddMessage(newMessage); db.UpdateChatNotification(newMessage, senderName); Clients.User(to).gotMessage(Context.User.Identity.Name, message); }