public IHttpActionResult Post(Customer customer) { var mng = new CustomerManagement(); mng.Create(customer); apiResp = new ApiResponse(); apiResp.Message = "Action was excecuted..."; return(Ok(apiResp)); }
private void button1_Click(object sender, EventArgs e) { try { CM.Create(cname.Text, ccontact.Text); lbMessage.Text = "Inserted !"; } catch (Exception er) { lbMessage.Text = er.Message.ToString(); } }
private void BtnAddCustomer_Click(object sender, EventArgs e) { try { var info = txtCustomerId.Text.ToString() + ',' + txtCustomerName.Text.ToString() + ',' + txtCustomerLastName.Text.ToString() + ',' + numericCustomerAge.Value.ToString() + ',' + DateTimeCustomer.Value.ToString("yyyy-MM-dd") + ',' + CivilComboBoxCustomer.SelectedItem.ToString() + ',' + GenderComboBoxCustomer.SelectedItem.ToString(); var infoArray = info.Split(','); cx = new Customer(infoArray); mng.Create(cx); MessageBox.Show("Customer created"); } catch (Exception es) { throw; } }
// POST: api/Customer public IHttpActionResult Post(Customer customer) { try { var cxMng = new CustomerManagement(); cxMng.Create(customer); apiResponse = new ApiResponse(); apiResponse.Message = "Customer created"; return(Ok(apiResponse)); } catch (BusinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "--" + bex.AppMessage.Message))); } }