예제 #1
0
        public async Task <ActionResult <Agentdetial> > PostAgentdetial(Agentdetial agentdetial)
        {
            _context.Agentdetials.Add(agentdetial);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAgentdetial", new { id = agentdetial.id }, agentdetial));
        }
예제 #2
0
        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());
        }
예제 #3
0
        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);
            }
        }