public JsonResult SaveSponsorerInfo(SponsorerInfoEntity sponsorInfo) { dynamic jsonData = default(dynamic); try { sponsorInfo.AddedBy = Convert.ToInt32(Session["UserID"]); int SponsorID = new ContactUsService().SaveSponsorInfo(sponsorInfo); if (SponsorID > 0) { jsonData = new { IsSuccess = true }; } else { jsonData = new { IsSuccess = false }; } } catch (Exception) { jsonData = new { IsSuccess = false }; } return(Json(jsonData, JsonRequestBehavior.AllowGet)); }
internal int SaveSponsorInfo(SponsorerInfoEntity sponsorEntity) { using (_httpClient = new HttpClient()) { string WebAPIURL = System.Configuration.ConfigurationManager.AppSettings["WebAPIURL"].ToString(); string apiMethod = "SaveSponsorerInfo"; string completeURL = WebAPIURL + apiMethod + '/'; StringContent httpContent = new StringContent(JsonConvert.SerializeObject(sponsorEntity), Encoding.UTF8, "application/json"); var response = _httpClient.PostAsync(completeURL, httpContent).Result; if (response.IsSuccessStatusCode) { return(Convert.ToInt32(response.Content.ReadAsStringAsync().Result)); } else { return(0); } } }