public HttpResponseMessage Post(Address addressData) { string strId = addressData.id; try { if (Convert.ToInt32(strId) == 0) { ObjAddressBL.postAddressToDb(addressData); } else { ObjAddressBL.updateAddressToDb(addressData, Convert.ToInt32(strId)); } return(Request.CreateResponse(HttpStatusCode.Created)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }