public void sendToClient(Notification notification, string clientName)
 {
     // Call the broadcastMessage method to update clients.
     //Clients.Caller.broadcastMessage(notification.Date, notification.Description);
     if (clientsDictionary.ContainsKey(clientName))
         Clients.Client(clientsDictionary[clientName]).broadcastNotification(notification);
 }
        public IHttpActionResult PostNotification(Notification notification)
        {
            response.status = "FAILURE";
            if (!ModelState.IsValid)
            {
                response.message = "Bad request.";
                return Ok(response);
            }
            try
            {
                db.Notifications.Add(notification);
                db.SaveChanges();
                response.status = "SUCCESS";
                response.objParam1 = notification;
            }
            catch (Exception e)
            {
                response.message = e.InnerException.InnerException.Message.ToString();
            }

            return Ok(response);
        }
        public IHttpActionResult PutNotification(int id, Notification notification)
        {
            response.status = "FAILURE";
            if (!ModelState.IsValid || id != notification.Id)
            {
                response.message = "Bad request.";
                return Ok(response);
            }

            db.Entry(notification).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
                response.status = "SUCCESS";
                response.objParam1 = notification;
            }
            catch (Exception e)
            {
                if (!NotificationExists(id))
                {
                    response.message = "Notification doesn't exist.";
                }
                else
                {
                    response.message = e.InnerException.InnerException.Message.ToString();
                }
            }

            return Ok(response);
        }