53 lines
2.0 KiB
C#
53 lines
2.0 KiB
C#
namespace LaaProduction.Console
|
|
{
|
|
using LaaProduction.Data.Cordonel.Models;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Net.Http;
|
|
using System.Net.Http.Headers;
|
|
using System.Threading;
|
|
|
|
public class Program
|
|
{
|
|
public static void Main(String[] args)
|
|
{
|
|
while (true)
|
|
{
|
|
var pcbId = 212120036;
|
|
var applicationJson = new MediaTypeWithQualityHeaderValue("application/json");
|
|
var url = "http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/cordonel/eolprogress";
|
|
var httpclient = new HttpClient();
|
|
httpclient.DefaultRequestHeaders.Accept.Add(applicationJson);
|
|
|
|
var deleted = httpclient
|
|
.DeleteAsync($"{url}/{pcbId}")
|
|
.Result;
|
|
var deletedContent = deleted.Content.ReadAsStringAsync().Result;
|
|
var deletedModel = JsonConvert.DeserializeObject<EOLProgressModel>(deletedContent);
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
var created = httpclient
|
|
.GetAsync($"{url}/{pcbId}")
|
|
.Result;
|
|
var createdContent = created.Content.ReadAsStringAsync().Result;
|
|
var createdModel = JsonConvert.DeserializeObject<EOLProgressModel>(createdContent);
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
createdModel.AttachmentsChecked = EOLStatus.OK;
|
|
createdModel.EOLSoftwareNameAndVersion = "a";
|
|
|
|
var postedJson = JsonConvert.SerializeObject(createdModel, Formatting.Indented);
|
|
var postedBody = new StringContent(postedJson);
|
|
postedBody.Headers.ContentType = applicationJson;
|
|
var posted = httpclient
|
|
.PostAsync(url, postedBody)
|
|
.Result;
|
|
|
|
var postedContent = posted.Content.ReadAsStringAsync().Result;
|
|
var postedModel = JsonConvert.DeserializeObject<EOLProgressModel>(postedContent);
|
|
}
|
|
}
|
|
}
|
|
} |