private void BtnAddCredit_Click(object sender, EventArgs e) { try { var info = txtCreditAmount.Text.ToString() + ',' + txtCreditRate.Text.ToString() + ',' + txtCreditName.Text.ToString() + ',' + txtCreditFee.Text.ToString() + ',' + CreditStartDate.Value.ToString("yyyy-MM-dd") + ',' + ComboBoxStatus.SelectedItem.ToString() + ',' + txtOperationalBalance.Text.ToString() + ',' + txtFkCustomerId.Text.ToString(); var infoArray = info.Split(','); credits = new Credit(infoArray); mngCre.Create(credits); MessageBox.Show("Credit created"); } catch (Exception es) { MessageBox.Show("Bad Values or missing values" + es); } }
// POST: api/Credit public IHttpActionResult Post(Credit credit) { try { var credMng = new CreditMangement(); credMng.Create(credit); apiResponse = new ApiResponse(); apiResponse.Message = "Credit created"; return(Ok(apiResponse)); } catch (BusinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "--" + bex.AppMessage.Message))); } }