public static string WMSaveAPIDetail(object objCon, string State) { string result = ""; CustomProfile profile = CustomProfile.GetProfile(); iCompanySetupClient aggregator = new iCompanySetupClient(); mAgreegatorAPI AgreAPI = new mAgreegatorAPI(); try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary = (Dictionary <string, object>)objCon; AgreAPI.AgreegatorID = long.Parse(dictionary["AggregatorID"].ToString()); AgreAPI.APIName = dictionary["APIName"].ToString(); AgreAPI.Purpose = dictionary["Purpose"].ToString(); AgreAPI.InputParameter = dictionary["InputPara"].ToString(); AgreAPI.OutputParameter = dictionary["OutPutPara"].ToString(); AgreAPI.APIURL = dictionary["ApiURL"].ToString(); AgreAPI.Remark = dictionary["Remark"].ToString(); AgreAPI.Active = dictionary["Active"].ToString(); AgreAPI.CompanyID = long.Parse(dictionary["CompanyID"].ToString()); AgreAPI.CustomerID = long.Parse(dictionary["CustomerID"].ToString()); if (State == "Edit") { AgreAPI.ID = Convert.ToInt64(HttpContext.Current.Session["AggreAPIID"].ToString()); long AggiAPIID = aggregator.SaveAggreegatorAPI(AgreAPI, profile.DBConnection._constr); } else { long AggiAPIID = aggregator.SaveAggreegatorAPI(AgreAPI, profile.DBConnection._constr); } result = "API saved successfully"; } catch { result = "Some error occurred"; } finally { aggregator.Close(); } return(result); }