示例#1
0
 public ActionResult Input(string id = "")
 {
     try
     {
         if (string.IsNullOrEmpty(id))
         {
             ViewBag.Title = "Create new Country";
             Country newCountry = new Country()
             {
                 CountryID = 0
             };
             return(View(newCountry));
         }
         else
         {
             ViewBag.Title = "Edit a Country";
             Country editCountry = CataLogBLL.GetCountry(Convert.ToInt32(id));
             if (editCountry == null)
             {
                 return(RedirectToAction("Index"));
             }
             return(View(editCountry));
         }
     }
     catch (Exception ex)
     {
         return(Content(ex.Message + "" + ex.StackTrace));
     }
 }