public ActionResult Index(string message = null) { if (!string.IsNullOrEmpty(message)) { EmailSubmitModel emailSubmitModel = new EmailSubmitModel { Message = message }; return(View(emailSubmitModel)); } return(View()); }
/// <summary> /// The index. /// </summary> /// <param name="trackingId"> /// The tracking id. /// </param> /// <param name="userGuid"> The user Guid. </param> /// <param name="isTest"> The is Test. </param> /// <returns> /// The <see cref="ActionResult"/>. /// </returns> public ActionResult Index(Guid?trackingId = null, Guid?userGuid = null, bool?isTest = null) { this.ViewBag.submitType = this.submitTypes; try { EmailSubmitModel model = null; if (trackingId.HasValue && userGuid.HasValue && isTest.HasValue) { if (isTest.Value) { model = new EmailSubmitModel { TrackingId = trackingId.Value, EmailSubmitJobCompleted = false, DownloadLink = new Uri(string.Format("{0}/{1}-download.eml", WebApiApplication.EmailsBasePath, trackingId.Value)), ViewLink = new Uri(string.Format("{0}/{1}-view.eml", WebApiApplication.EmailsBasePath, trackingId.Value)), }; var client = new HttpClient(); Task getTask = client.GetAsync(model.ViewLink).ContinueWith( task => { if (task.Exception != null) { throw task.Exception; } if (task.Result.IsSuccessStatusCode) { model.EmailSubmitJobCompleted = true; } }, TaskContinuationOptions.ExecuteSynchronously); getTask.Wait(); return(this.View(model)); } return(this.View("UserMessage", userGuid)); } return(this.View(model)); } catch (Exception e) { Log.Warn("Email Job View Return Error. Details: {0}", e); return(this.View("Error")); } }