public ActionResult Input(Country model) { try { if (string.IsNullOrEmpty(model.CountryName)) { ModelState.AddModelError("CountryName", "CountryName expected"); } if (!ModelState.IsValid) { ViewBag.Title = model.CountryID == 0 ? "Create new Country" : "Edit a Country"; return(View(model)); } if (model.CountryID == 0) { CataLogBLL.AddCountry(model); } else { CataLogBLL.UpdateCountry(model); } return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("Loi", ex.StackTrace); return(View(model)); } }