Exemplo n.º 1
0
        public ActionResult MergeCustomer([FromRoute] long customerId, [FromBody] MergeCustomerRequest request)
        {
            var existingCustomer = Customers.SingleOrDefault(c => c.Id == customerId);

            if (existingCustomer == null)
            {
                var customer =
                    new Customer
                {
                    Id        = Customers.Max(c => c.Id) + 1,
                    FirstName = request.FirstName,
                    LastName  = request.LastName
                };
                Customers.Add(customer);
            }
            else
            {
                existingCustomer.FirstName = request.FirstName;
                existingCustomer.LastName  = request.LastName;
            }

            return(Ok());
        }
Exemplo n.º 2
0
 /// <remarks/>
 public void MergeCustomerAsync(MergeCustomerRequest MergeCustomerRequest, object userState) {
     if ((this.MergeCustomerOperationCompleted == null)) {
         this.MergeCustomerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMergeCustomerOperationCompleted);
     }
     this.InvokeAsync("MergeCustomer", new object[] {
                 MergeCustomerRequest}, this.MergeCustomerOperationCompleted, userState);
 }
Exemplo n.º 3
0
 /// <remarks/>
 public void MergeCustomerAsync(MergeCustomerRequest MergeCustomerRequest) {
     this.MergeCustomerAsync(MergeCustomerRequest, null);
 }