public ActionResult Edit(Country model) { model.OrganizationId = OrganizationId; model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID.ToString(); var repo = new CountryRepository(); bool isexists = repo.IsFieldExists(repo.ConnectionString(), "Country", "CountryName", model.CountryName, "CountryId", model.CountryId); if (!isexists) { var result = new CountryRepository().UpdateEmployeeLocation(model); if (result.CountryId > 0) { TempData["Success"] = "Updated Successfully!"; TempData["CountryRefNo"] = result.CountryRefNo; return(RedirectToAction("Create")); } else { TempData["error"] = "Oops!!..Something Went Wrong!!"; TempData["CountryRefNo"] = null; return(View("Create", model)); } } else { TempData["error"] = "This Name Alredy Exists!!"; TempData["CountryRefNo"] = null; return(View("Create", model)); } }