public ActionResult ByCtid(string ctid) { if (!IsAuthorized()) { if (UtilityManager.GetAppKeyValue("envType") != "production") { //allow, and log string referer = GetUserReferrer(); string ipAddress = this.GetUserIPAddress(); LoggingHelper.DoTrace(4, string.Format("ImportController.ByCtid() NON-AUTHENTICATED REQUEST. For Ctid: {0}, referer: {1}, ipAddress: {2}", ctid, referer, ipAddress)); } else { msg.Title = "ERROR - you are not authorized for this action."; msg.Message = "<a href='/Account/Login'>Please log in</a> with an account that has sufficient authority."; Session["siteMessage"] = msg.Message; return(RedirectToAction("Index", "Home")); } } ImportRequest mgr = new ImportRequest(); SaveStatus status = new SaveStatus(); if (!string.IsNullOrWhiteSpace(ctid)) { LoggingHelper.DoTrace(4, "ImportController. Starting ByCtid: " + ctid); status = mgr.ImportByCtid(ctid); //if ( !status.HasErrors ) ElasticServices.UpdateElastic(false); } else { SetPopupErrorMessage("ERROR - provide a valid ctid "); msg.Title = "ERROR - provide a valid CTID or envelopeId"; msg.Message = "Either a valid CTID, or a valid registry envelope identifier must be provided."; Session["siteMessage"] = msg; return(View("index", status)); } return(View("index", status)); }
//[Authorize] //[HttpPost, Route( "Import/doimport/{model}" )] public ActionResult DoImport(SaveStatus model) { ImportRequest mgr = new ImportRequest(); SaveStatus status = new SaveStatus(); status.Community = status.Community ?? ""; if (!string.IsNullOrWhiteSpace(model.Ctid) && model.Ctid.Length == 39) { status = mgr.ImportByCtid(model.Ctid); //if ( !status.HasErrors ) ElasticServices.UpdateElastic(false); } else if (!string.IsNullOrWhiteSpace(model.EnvelopeId) && model.EnvelopeId.Length == 36) { status = mgr.ImportByEnvelopeId(model.EnvelopeId); //if ( !status.HasErrors ) ElasticServices.UpdateElastic(false); } else { SetPopupErrorMessage("ERROR - provide a valid CTID or envelopeId "); msg.Title = "ERROR - provide a valid CTID or envelopeId"; msg.Message = "Either a valid CTID, or a valid registry envelope identifier must be provided."; Session["siteMessage"] = msg; return(View("index")); //return RedirectToAction( "Index", "Home" ); } if (status.Messages.Count == 0 && string.IsNullOrWhiteSpace(status.DetailPageUrl)) { status.Messages.Add(new StatusMessage() { Message = "Import was successful, there is no detail page for this document type.", IsWarning = true }); } return(View("Index", status)); }