public ActionResult EditUpdateCompany(CompanyModel objcomp) { try { if (objcomp.companyid == 0) {//SPinsertCompanyClient context.SPinsertCompanyClient(objcomp.citycircle, objcomp.biztype, objcomp.name, objcomp.addr1, objcomp.addr2, objcomp.city, objcomp.state, objcomp.zip, objcomp.weburl, objcomp.phone, objcomp.priority, objcomp.target, objcomp.combinednotes, objcomp.adminnotes, objcomp.notes, objcomp.listid, User.Identity.Name); context.SaveChanges(); TempData["Message"] = "Record Saved"; } if (objcomp.companyid != 0) { context.SPupdateCompanies(objcomp.citycircle, objcomp.biztype, objcomp.name, objcomp.addr1, objcomp.addr2, objcomp.city, objcomp.state, objcomp.zip, objcomp.weburl, objcomp.phone, objcomp.priority, objcomp.target, objcomp.combinednotes, objcomp.adminnotes, objcomp.notes, objcomp.companyid, objcomp.listid); context.SaveChanges(); TempData["Message"] = "Record Updated"; } var listname = context.Prospecting_Lists.Where(x => x.listid == objcomp.listid).FirstOrDefault().listname; objcomp.listname = listname; } catch (Exception ex) { TempData["Message"] = "Some Error Occured"; } return(RedirectToAction("Index", new { @listid = objcomp.listid, @lstname = objcomp.listname })); }