public void AddPerson(Person person)
 {
     if (person != null)
     {
         var dbPerson = db.Persons.Where(p => p.Address == person.Address).FirstOrDefault();
         if (dbPerson == null)
         {
             db.Persons.Add(person);
         }
         else
         {
             dbPerson.Name = person.Name;
             dbPerson.Phone = person.Phone;
             dbPerson.Address = person.Address;
         }
         db.SaveChanges();
     }
 }
        public async Task<string> BookSync(Person pickup, Person dropoff)
        {
            using (var client = new HttpClient())
            {
                // New code:
                client.BaseAddress = new Uri(server);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                var body = new
                {
                    apiKey = merchantKey,
                    booking = new
                    {
                        pickupDetail = pickup,
                        dropoffDetail = dropoff
                    }
                };

                HttpResponseMessage response = await client.PostAsJsonAsync("api/v2/deliveries", body);
                return await response.Content.ReadAsStringAsync();
            }
        }
 public async Task<string> Book(Person pickup, Person dropoff)
 {
     return await new SwiftAPI.DeliveryService(MerchantKey).BookSync(pickup, dropoff);
 }
 public void AddPerson(Person person)
 {
     repo.AddPerson(person);
 }