public async Task <ConcurrentBag <Model> > Quote3(IndexModel model) { Stopwatch sw = new Stopwatch(); sw.Start(); Connection.UpdateWebServiceBaseAddress(model.ApiServer); QuoteRequestStringJsonHybrid quoter = new QuoteRequestStringJsonHybrid(); this.Session?.Add(typeof(QuoteRequestStringJsonHybrid).FullName, quoter); string clientDefinedIdPrefix = "BR-" + StringUtilities.CreateRandomString(8); try { if (model.WaitUntilCompleted) { return(await quoter.Quote(model.Form, clientDefinedIdPrefix, 0, false, sw)); } Task.Run(() => quoter.Quote(model.Form, clientDefinedIdPrefix, 0, false, sw)).ConfigureAwait(false); } catch (Exception ex) { Debug.WriteLine(ex.Message); } return(null); }
public string GetCounts3() { try { QuoteRequestStringJsonHybrid quoter = this.Session[typeof(QuoteRequestStringJsonHybrid).FullName] as QuoteRequestStringJsonHybrid; if (quoter != null) { return(JsonConvert.SerializeObject(quoter, Global.JsonSettings)); } } catch (Exception e) { Debug.WriteLine(e); } return(null); }
public JsonResult GetResults3() { try { QuoteRequestStringJsonHybrid quoter = this.Session[typeof(QuoteRequestStringJsonHybrid).FullName] as QuoteRequestStringJsonHybrid; if (quoter != null) { return(Json(quoter.GetResult(), JsonRequestBehavior.AllowGet)); } } catch (Exception e) { Debug.WriteLine(e); } return(null); }