public async Task <ActionResult <Agentdetial> > PostAgentdetial(Agentdetial agentdetial) { _context.Agentdetials.Add(agentdetial); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAgentdetial", new { id = agentdetial.id }, agentdetial)); }
public async Task <IActionResult> PutAgentdetial(int id, Agentdetial agentdetial) { if (id != agentdetial.id) { return(BadRequest()); } _context.Entry(agentdetial).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AgentdetialExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void getAgentDetail() { string url = "https://10.0.2.2:5001/api/Agentdetials/" + agentid; var httpWebRequest = new HttpWebRequest(new Uri(url)); //var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.ServerCertificateValidationCallback = delegate { return(true); }; //httpWebRequest.ServerCertificateCustomValidationCallback = delegate { return true; } httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "GET"; var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { var result = streamReader.ReadToEnd(); agent1 = JsonConvert.DeserializeObject <Agentdetial>(result); } }