示例#1
0
        public async Task <HttpResponseMessage> AddCustomerAddress([FromBody] M_BillingAddress address)
        {
            try
            {
                M_BillingAddress customer = new OnlineShop.Model.M_BillingAddress();
                await Task.Run(() =>
                {
                    customer = icustomer.AddNewAddress(address);
                });

                if (customer != null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, customer));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound, new { StatusCode = HttpStatusCode.NotFound, Status = "Failed" }));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }