public HttpResponseMessage Post([FromBody] WMData wmData) { if (wmData != null && wmData.LMI_SYS_TRANS_NO != 0) { using (SqlConnection connection = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["DBCS"].ConnectionString)) { SqlCommand cmd = new SqlCommand("spModifyBills", connection); cmd.CommandType = System.Data.CommandType.StoredProcedure; try { cmd.Parameters.AddWithValue("@Id", wmData.LMI_PAYMENT_NO); connection.Open(); cmd.ExecuteNonQuery(); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } } } return(Request.CreateResponse(HttpStatusCode.OK, "OK")); }
public ActionResult OnSuccess(WMData wmData) { using (HttpClient client = WebApiClient.InitializeClient(Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/")) { HttpResponseMessage response = client.PostAsJsonAsync("api/Webmoney/PostTransactionData", wmData).Result; if (!response.IsSuccessStatusCode) { try { string _message = response.Content.ReadAsAsync <string>().Result; return(RedirectToAction("Index", "Service", new { message = _message })); } catch { return(RedirectToAction("Index", "Service")); } } else { return(RedirectToAction("Index", "Service")); } } }