public async Task <IActionResult> Edit(int id, [Bind("CompShopId,Dept,ItemNo,Promo,WHSE,State,MAC,Sell,IMU,FutureSellPrice,FutureSellDate,LowestComp,MaxPrice,NewSell,NewPrice,SamsConvPrice,SamsShelfPrice,SamsAddtnPrice,SamsShoppedURL,SamsShoppedZip,BJsConvPrice,,BJsShelfPrice,BJsAddtnPrice,BJsShoppedURL,BJsShoppedZip,BuyerNo,Category,BuyerComments,PulledDate")] CompShop compShop) { if (id != compShop.CompShopId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(compShop); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompShopExists(compShop.CompShopId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(compShop)); }
public async Task <IActionResult> Create([Bind("CompShopId,Dept,ItemNo,Promo,WHSE,State,MAC,Sell,IMU,FutureSellPrice,FutureSellDate,LowestComp,MaxPrice,NewSell,NewPrice,SamsConvPrice,SamsShelfPrice,SamsAddtnPrice,SamsShoppedURL,SamsShoppedZip,BJsConvPrice,,BJsShelfPrice,BJsAddtnPrice,BJsShoppedURL,BJsShoppedZip,BuyerNo,Category,BuyerComments,PulledDate")] CompShop compShop) { if (ModelState.IsValid) { _context.Add(compShop); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(compShop)); }
//static async Task<string> GetResponseFromURI(Uri u) //{ // var response = ""; // using (var client = new HttpClient()) // { // HttpResponseMessage result = await client.GetAsync(u); // if (result.IsSuccessStatusCode) // { // response = await result.Content.ReadAsStringAsync(); // } // } // return response; //} public async Task GetBusinessRulesAsync() { string myJson = "{\"RuleApp\":{\"RepositoryRuleAppRevisionSpec\":{\"RuleApplicationName\":\"CompShop\"},\"UseIntegratedSecurity\":\"false\",\"UserName\":\"amol_morankar29\",\"Password\":\"AkfGGjHj\"},\"RuleEngineServiceOptions\":{\"Overrides\":\"\"},\"RuleEngineServiceOutputTypes\":{\"ActiveNotifications\":\"true\",\"ActiveValidations\":\"false\",\"EntityState\":\"true\",\"Overrides\":\"true\",\"RuleExecutionLog\":\"false\"},\"EntityName\":\"CompShopData\",\"EntityState\":\"{\\\"State\\\":\\\"WA\\\"}\"}"; using (var client = new HttpClient()) { var comps = new CompShop(); comps.State = "WA"; comps.CompShopId = 1; //var json1 = JsonConvert.SerializeObject(comps); var data = new StringContent(myJson, Encoding.UTF8, "application/json"); var url = "https://trial-9fbyxg-986-execute.inrulecloud.com/HttpService.svc/ApplyRules"; client.DefaultRequestHeaders.Add("Authorization", "APIKEY 3b77901f4c144b6cb87f9e6a8c1f68c5"); var response = await client.PostAsync(url, data); string result = response.Content.ReadAsStringAsync().Result; //client.DefaultRequestHeaders.Add("Authorization", "APIKEY 3b77901f4c144b6cb87f9e6a8c1f68c5"); //client.BaseAddress = new Uri("https://trial-9fbyxg-986-execute.inrulecloud.com/HttpService.svc/ApplyRules"); //var response = await client.PostAsync( // "https://trial-9fbyxg-986-execute.inrulecloud.com/HttpService.svc/ApplyRules", // new StringContent(json, Encoding.UTF8, "application/json")); } /*Uri baseUrl = new Uri("https://trial-9fbyxg-986-execute.inrulecloud.com/HttpService.svc/ApplyRules"); * IRestClient client = new RestClient(baseUrl); * * * * IRestRequest request = new RestRequest("post", Method.POST) { Credentials = new NetworkCredential("amol_morankar29", "AkfGGjHj") }; * request.AddHeader("Authorization", "APIKEY 3b77901f4c144b6cb87f9e6a8c1f68c5"); * //request.AddParameter("clientId", 123); * * IRestResponse<CompShop> response = client.Execute<CompShop>(request); * * if (response.IsSuccessful) * { * Console.WriteLine(response.Data.StateMin); * } * else * { * Console.WriteLine(response.ErrorMessage); * }*/ }