Esempio n. 1
0
 // PUT
 // UPDATE
 public IHttpActionResult Put(Credit credit)
 {
     try
     {
         var mng = new CreditManager();
         mng.Update(credit);
         return(Content(HttpStatusCode.OK, "CREDITO ACTUALIZADO"));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(Content(HttpStatusCode.BadRequest, "ERROR AL ACTUALIZAR"));
     }
 }
Esempio n. 2
0
        // PUT
        // UPDATE
        public IHttpActionResult Put(Credit credit)
        {
            try
            {
                var mng = new CreditManager();
                mng.Update(credit);

                apiResp         = new ApiResponse();
                apiResp.Message = "Action was executed.";

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message)));
            }
        }
        private void btnCreditUpdate_Click(object sender, EventArgs e)
        {
            Result result = _creditManager.Update(new Credit
            {
                Id         = int.Parse(txtCreditId.Text),
                OrderId    = _orderId,
                Amount     = decimal.Parse(txtCreditAmount.Text),
                Name       = txtCreditName.Text,
                Surname    = txtCreditSurname.Text,
                CardNumber = txtCardNumber.Text,
                Cvc        = short.Parse(txtCVC.Text)
            });

            if (result.ResultState == ResultState.Erorr)
            {
                MessageBox.Show(result.Message, "Hata işlem yapılamadı");
            }
            else
            {
                DataGridCreditFill();
                TextBoxCreditClear();
            }
        }