public async Task <IActionResult> Index(ContractViewModel contractViewModel) { int ret = -1; if (contractViewModel.FirstPartyId == contractViewModel.SecondPartyId) { ModelState.AddModelError("Error", "Both Entity Cannot be same"); var returnmodel = await InitializeModel(); returnmodel.FirstPartyId = contractViewModel.FirstPartyId; returnmodel.SecondPartyId = contractViewModel.SecondPartyId; return(View(returnmodel)); } var contract = new ContractDTO { SecondPartyId = contractViewModel.SecondPartyId.Split('|')[1], FirstPartyId = contractViewModel.FirstPartyId.Split('|')[1], SecondParty = contractViewModel.SecondPartyId.Split('|')[0], FirstParty = contractViewModel.FirstPartyId.Split('|')[0], ContractId = contractViewModel.ContractId }; if (string.IsNullOrEmpty(contractViewModel.ContractId)) { ret = await _contractClient.CreateContract(contract); } else { ret = await _contractClient.UpdateContract(contractViewModel.ContractId, contract); } ModelState.AddModelError("Sucess", "Contract Saved."); return(View(await InitializeModel())); }