Example #1
0
        public static void SendMessageNewContact(Contact contact)
        {
            var msg = String.Format("Novo contato: {0} <{1}>", contact.Name, contact.Email);

            var hubContext = GlobalHost.ConnectionManager.GetHubContext<NotificationHub>();
            hubContext.Clients.All.newContact(msg);
        }
Example #2
0
        // POST api/contacts
        public Contact Post(Contact contact)
        {
            contact.Id = Guid.NewGuid();
            Contacts.Add(contact);

            NotificationHub.SendMessageNewContact(contact);
            return contact;
        }