public ActionResult AddDemoDocs() { var wc = new WebClient(); var docLinks = wc.DownloadString(TARGET_URL); var linksSplitted = new List <string>(); var docLangIds = new List <int>(); string ip = Request.UserHostAddress; string basePath = HttpRuntime.AppDomainAppPath; // parse try { linksSplitted = docLinks.Split(';').ToList(); foreach (var link in linksSplitted) { if (link.Contains("LegalAct") || link.Contains("CourtAct")) { var regexObj = new Regex(REGEX_PATTERN_IDS); var matches = regexObj.Matches(link); docLangIds.Add(int.Parse(matches[0].Value)); } } } catch (Exception) { Logger.LogDemoDocs(basePath, ERROR_MESSAGE_PARSE, ip, new List <int>(), new List <string>()); return(Content(ERROR_MESSAGE_PARSE)); } // db update int documentsUpdated = 0; try { documentsUpdated = Doc.AddDemoDocs(docLangIds.ToArray()); Logger.LogDemoDocs(basePath, String.Empty, ip, docLangIds, new List <string>()); } catch (Exception) { Logger.LogDemoDocs(basePath, ERROR_MESSAGE_DB, ip, new List <int>(), new List <string>()); return(Content(ERROR_MESSAGE_DB)); } // TODO: Return doc identifiers and pass them here return(Content(SUCCESS_MESSAGE)); }