public ActionResult UpdateCustomer(Customer customer)
        {
            var client = new HttpClient { BaseAddress = new Uri(ConfigurationManager.AppSettings["ApiAddress"]) };
            //Task.Factory.StartNew(async delegate
            //{
            //    return await client.PutAsJsonAsync(ConfigurationManager.AppSettings["ApiAddress"], customer);
            //});

            client.PutAsJsonAsync(ConfigurationManager.AppSettings["ApiAddress"], customer);
            return View("Index");
        }
 private void btnFindCustomer_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         SelectedCustomer = _proxy.GetMyDetails(txtEmail.Text, txtCellNumber.Text);
     }
     catch (FaultException<ExceptionDetail> fe)
     {
         MessageBox.Show(fe.Detail.Message);
         SelectedCustomer = null;
     }
 }
 // GET api/test/5
 public Customer Get(string email)
 {
     _repository = new CrmManager();
     var customer = new Customer();
     var customers = _repository.FindCustomers(new CustomerCriteria());
     foreach (var c in customers)
     {
         if (c.Email == email)
         {
             customer = new Customer()
             {
                 ID = c.ID
             };
         }
     }
     return _repository.FindCustomer(customer.ID);
 }
 // POST api/test
 public void Post(Customer customer)
 {
     _repository = new CrmManager();
     var newCustomer = new Customer()
     {
         ID = Guid.NewGuid(),
         Address = customer.Address,
         BirthDate = customer.BirthDate,
         CellNumber = customer.CellNumber,
         Country = customer.Country,
         Email = customer.Email,
         FirstName = customer.FirstName,
         LastName = customer.LastName,
         PhoneNumber = customer.PhoneNumber,
         City = customer.City,
         ReductionCode = customer.ReductionCode
     };
     _repository.CreateCustomer(newCustomer);
 }
        // PUT api/test/5
        public void PutCustomer(Customer customer)
        {
            _repository = new CrmManager();
            _repository.UpdateCustomer(customer);

        }
 public void DeleteCustomer(Customer customer)
 {
     HttpClient client = new HttpClient();
     client.BaseAddress = new Uri("http://localhost:17016");
 }
 public void UpdateCustomer(Customer customer)
 {
     HttpClient client = new HttpClient();
     client.BaseAddress = new Uri("http://localhost:17016");
     client.PutAsJsonAsync("http://localhost:17016/api/customer", customer);
 }
 public void AddCustomer(Customer customer)
 {
     HttpClient client = new HttpClient();
     client.BaseAddress = new Uri(ConfigurationManager.AppSettings["ApiAddress"]);
     client.PostAsJsonAsync(ConfigurationManager.AppSettings["ApiAddress"] + "AddCustomer", customer);
 }
 public ActionResult AddCustomer(Customer customer)
 {
     var client = new HttpClient { BaseAddress = new Uri(ConfigurationManager.AppSettings["ApiAddress"]) };
     client.PostAsJsonAsync(ConfigurationManager.AppSettings["ApiAddress"], customer);
     return View("Index");
 }
 public ActionResult Index(Customer list)
 {
     return View(list);
 }