示例#1
0
        public void AddAdult(Adult adult)
        {
            int i = Adults.Count + 1;

            adult.Id = i;
            Adults.Add(adult);
            Firstnames.Add(adult.FirstName);
            Lastnames.Add(adult.LastName);
            HairColors.Add(adult.HairColor);
            EyeColors.Add(adult.EyeColor);
            Ids.Add(adult.Id);
            Jobs.Add(adult.Job);
        }
示例#2
0
        static async Task <string> PostData(Adult adult)
        {
            var httpClientHandler = new HttpClientHandler
            {
                ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true
            };
            HttpClient    client          = new HttpClient(httpClientHandler);
            string        adultSerialized = JsonSerializer.Serialize(adult);
            StringContent content         = new StringContent(
                adultSerialized, Encoding.UTF8,
                "application/json"
                );
            HttpResponseMessage response = await client.PutAsync("https://localhost:5001/Adult", content);

            return(response.ToString());
        }
示例#3
0
 public void Update(Adult toUpdate)
 {
     JobTitle = toUpdate.JobTitle;
     base.Update(toUpdate);
 }
示例#4
0
 public void Update(Adult toUpdate)
 {
     Job = toUpdate.Job;
     base.Update(toUpdate);
 }
示例#5
0
 public void addAdult(Adult adult)
 {
     PostData(adult);
 }