public Transaction Post([FromBody] Transaction pTransaction) { try { if (!bConnectToAPI.HasValue) { string s = (new ConfigurationBuilder()).AddJsonFile("appsettings.json").Build().GetSection("CustomVariables")["ConnectToAPI"]; bConnectToAPI = string.IsNullOrEmpty(s) ? false : s == "Yes" ? true : false; } if (bConnectToAPI.Value) { return(APIHandler <Transaction> .PostMethod("https://localhost:44318/Transactions", pTransaction)); } else { //Product pProduct = JsonSerializer.Deserialize<Product>(product); //UIIndependentTest test = new UIIndependentTest(); //test.LoadTestData(); //test.AddT(pProduct); //return pProduct; } } catch (Exception ex) { //UIIndependentTest test = new UIIndependentTest(); //test.LoadTestData(); //return UIIndependentTest.Products.FirstOrDefault(); } return(null); }
public Member post([FromBody] Member member) { try { if (!bConnectToAPI.HasValue) { string s = (new ConfigurationBuilder()).AddJsonFile("appsettings.json").Build().GetSection("CustomVariables")["ConnectToAPI"]; bConnectToAPI = string.IsNullOrEmpty(s) ? false : s == "Yes" ? true : false; } if (bConnectToAPI.Value) { return(APIHandler <Member> .PostMethod("https://localhost:44367/Members", member)); } else { UIIndependentTest test = new UIIndependentTest(); test.LoadTestData(); test.AddMember(member); return(member); } } catch (Exception ex) { UIIndependentTest test = new UIIndependentTest(); test.LoadTestData(); return(UIIndependentTest.Members.FirstOrDefault()); } }
public Product post([FromBody] Product pProduct) //string product { try { if (!bConnectToAPI.HasValue) { string s = (new ConfigurationBuilder()).AddJsonFile("appsettings.json").Build().GetSection("CustomVariables")["ConnectToAPI"]; bConnectToAPI = string.IsNullOrEmpty(s) ? false : s == "Yes" ? true : false; } if (bConnectToAPI.Value) { return(APIHandler <Product> .PostMethod("https://localhost:44303/Products", pProduct)); } else { UIIndependentTest test = new UIIndependentTest(); test.LoadTestData(); test.AddProduct(pProduct); return(pProduct); } } catch (Exception ex) { UIIndependentTest test = new UIIndependentTest(); test.LoadTestData(); return(UIIndependentTest.Products.FirstOrDefault()); } }
public Member Delete([FromBody] Member member) { try { if (!bConnectToAPI.HasValue) { string s = (new ConfigurationBuilder()).AddJsonFile("appsettings.json").Build().GetSection("CustomVariables")["ConnectToAPI"]; bConnectToAPI = string.IsNullOrEmpty(s) ? false : s == "Yes" ? true : false; } if (bConnectToAPI.Value) { member.IsDeleted = 1; return(APIHandler <Member> .PostMethod("https://localhost:44367/Members", member)); } } catch (Exception ex) { throw; } return(null); }