public JsonResult AddUpdateAgentBank(int id, int agentId, int bankId, int branchId, int accountTypeId, string accountname, string accountnumber, string banktype) { AgentBankModel agentbankresult = new AgentBankModel(); if (id == 0) //// adding new data { AgentBankModel SaveAgentBank = new AgentBankModel() { BankId = bankId, BankBranchId = branchId, BankAccountTypeId = accountTypeId, AccountName = accountname, AccountNumber = accountnumber, BankType = banktype }; int AgentBankid = _agentProvider.SaveAgentBankInfo(SaveAgentBank, agentId); agentbankresult = _agentProvider.GetAgentBankInfo(AgentBankid); } else ///// updating existing data { AgentBankModel UpdateAgentBank = new AgentBankModel() { AgentBankId = id, BankId = bankId, BankBranchId = branchId, BankAccountTypeId = accountTypeId, AccountName = accountname, AccountNumber = accountnumber, }; _agentProvider.UpdateAgentBankInfo(UpdateAgentBank); agentbankresult = _agentProvider.GetAgentBankInfo(id); } /////// Returing JSON Result Back /////////////// JsonResult result = new JsonResult(); result.Data = agentbankresult; return(result); }