public HttpResponseMessage Add([FromBody] JObject jfrom) { if (jfrom == null) { return(Request.CreateResponse(HttpStatusCode.OK, 0)); } string sName = jfrom["Name"].ToString(); string sDesc = jfrom["Desc"].ToString(); TypePayModel tp = new TypePayModel(); tp.Name = sName; tp.Desc = sDesc; try { SqlHelper.ExecuteNonQuery("TypeDeliveryAdd", tp.Name, tp.Desc); } catch { return(Request.CreateResponse(HttpStatusCode.OK, 0)); } return(Request.CreateResponse(HttpStatusCode.OK, 1)); }
public HttpResponseMessage Edit([FromBody] JObject jfrom) { if (jfrom == null) { return(Request.CreateResponse(HttpStatusCode.OK, 0)); } int iID = int.Parse(jfrom["TypeID"].ToString()); string sName = jfrom["Name"].ToString(); string sDesc = jfrom["Desc"].ToString(); TypePayModel tp = new TypePayModel(); tp.ID = iID; tp.Name = sName; tp.Desc = sDesc; try { SqlHelper.ExecuteNonQuery("TypePayUpdate", tp.ID, tp.Name, tp.Desc); } catch { return(Request.CreateResponse(HttpStatusCode.OK, 0)); } return(Request.CreateResponse(HttpStatusCode.OK, 1)); }