public RunTestsPage() { InitializeComponent(); LoggerUtil.GetTempPath(); LoggerUtil.LogMessageToFile("Initiated Run Tests Page."); this.backgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker_DoWork); this.backgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker_RunWorkerCompleted); this.backgroundWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker_ProgressChanged); this.backgroundWorker.WorkerSupportsCancellation = true; this.backgroundWorker.WorkerReportsProgress = true; NameScope.SetNameScope(this, new NameScope()); lastStackPanel.RegisterName("wpfProgressBar", wpfProgressBar); RunButton.IsEnabled = false; Browse.Content = "Browse" + Environment.NewLine + "Product DLL"; try { List <string> list = ProductDetails.GetProductList(); foreach (string s in list) { ProductNameComboBox.Items.Add(s); } } catch (Exception) { DisplayErrorMessage("Loading Products Failed"); } }
public IHttpActionResult GetProductList() { try { List <Product> produtResult = produtDetail.GetProductList(); if (produtResult.Count > 0) { status.code = 200; status.message = "success"; return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, new { status = status, result = produtResult }))); } else { status.code = 201; status.message = "Product Not Available?"; return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, new { status = status }))); } } catch (Exception ex) { status.code = 500; status.message = ex.Message.ToString(); return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, new { status = status }))); } }
public async Task <IActionResult> PostProductDetails([FromBody] Guid productID) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ProductDetails productList = new ProductDetails(); var productDetails = productList.GetProductList().First(e => e.ProductID == productID); _context.ProductDetails.Add(productDetails); await _context.SaveChangesAsync(); return(CreatedAtAction("GetProductDetails", new { id = productDetails.ProductID }, productDetails)); }
public void OnGet() { ProductDetails productDetails = new ProductDetails(); ProductList = productDetails.GetProductList(); }