public ActionResult Input(Countrie model, string method, string country) { if (string.IsNullOrEmpty(model.CountryName)) { ModelState.AddModelError("CountryName", "CountryName Expected"); } if (!ModelState.IsValid) { ViewBag.Title = model.CountryName == "" ? "Create new Country" : "Edit a Country"; return(View(model)); } if (method == "Edit a country") { CatalogBLL.Update(model, country); } else { if (CatalogBLL.Get(model.CountryName) != null) { ModelState.AddModelError("CountryName", "CountryName Existed"); if (!ModelState.IsValid) { ViewBag.Title = model.CountryName == "" ? "Create new Country" : "Edit a Country"; return(View(model)); } } else { CatalogBLL.Add(model); } } return(RedirectToAction("Index")); }