public XmlDocument SendMessage(Notification notification)
        {
            string responseString;
            var xmlDoc = new XmlDocument();

            SetData(notification);

            using (var wb = new WebClient())
            {
                byte[] response = wb.UploadValues(Url, "POST", data);

                responseString = Encoding.Default.GetString(response);
                xmlDoc.LoadXml(responseString);
            }
            ;

            return (xmlDoc);
        }
 private void SetData(Notification notification)
 {
     data["apikey"] = notification.Apikey;
     data["application"] = notification.ApplicationName;
     data["event"] = notification.Event;
     data["description"] = notification.Description;
     data["priority"] = notification.Priority.ToString();
     if (notification.DeveloperKey != 0)
     {
         data["developerkey"] = notification.DeveloperKey.ToString();
     }
     if (notification.UrlInNotification != "")
     {
         data["url"] = notification.UrlInNotification;
     }
     if (notification.HtmlAdded != false)
     {
         data["content-type"] = notification.HtmlAdded.ToString();
     }
 }
        public JsonResult Post(string apikey, string applicationName, string description,
            string eventHappening, int priority = 0, int developerkey = 0,
            string urlnotification = "", bool htmlAdded = false)
        {
            var notifacation = new Notification
            {
                Apikey = apikey,
                ApplicationName = applicationName,
                Description = description,
                Event = eventHappening,
                Priority = priority,
                DeveloperKey = developerkey,
                HtmlAdded = htmlAdded,
                UrlInNotification = urlnotification
            };

            XmlDocument response = VerifyService.CallNotifyVerify("apikey=" + apikey);
            ValidityAnswer parsedXml = VerifyService.ParseXML(response);

            if (parsedXml.Code == "200")
            {
                var postService = new PostService();
                parsedXml = VerifyService.ParseXML(postService.SendMessage(notifacation));
            }

            var model = new
            {
                responseCode = parsedXml.Code,
                responseError = parsedXml.Error,
                resetTimer = parsedXml.ResetTimer
            };

            var result = new JsonResult {Data = model};

            return result;
        }