Exemplo n.º 1
0
        public SiteEntity UpdateSingleSite(SiteEntity site)
        {
            SiteRepository siteRepository = new SiteRepository();

            siteRepository.Edit(site);

            return(site);
        }
Exemplo n.º 2
0
        public bool SiteWithTxtVerified(Guid IdSite)
        {
            bool           result         = false;
            SiteRepository siteRepository = new SiteRepository();
            SiteEntity     _site          = siteRepository.FindById(IdSite);

            System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(_site.URL.ToString() + "/kindads.txt");
            request.Method = "GET";

            try
            {
                System.Net.WebResponse webResponse = request.GetResponse();
                using (System.IO.Stream webStream = webResponse.GetResponseStream())
                {
                    if (webStream != null)
                    {
                        using (System.IO.StreamReader responseReader = new System.IO.StreamReader(webStream))
                        {
                            var _response = responseReader.ReadToEnd();
                            if (_response != null)
                            {
                                if (_response.Trim() == _site.VerificationString.Trim())
                                {
                                    //Verify Site
                                    _site.Verified = true;
                                    siteRepository.Edit(_site);
                                    result = true;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                //Do nothing
            }
            return(result);
        }