Exemplo n.º 1
0
 public ActionResult Create(CountryModel model)
 {
     if (ModelState.IsValid)
     {
         if (model.COUNTRY_ID == 0)
         {
             bool valid = CountryModel.insertCountry(model);
             if (valid)
             {
                 ModelState.Clear();
                 return(Json("Save Country successfully.", JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json("Issue in Save.", JsonRequestBehavior.AllowGet));
             }
         }
         else
         {
             bool valid = CountryModel.updateCountry(model);
             if (valid)
             {
                 ModelState.Clear();
                 return(Json("Update Country successfully.", JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json("Issue in Save.", JsonRequestBehavior.AllowGet));
             }
         }
     }
     else
     {
         return(Json("Please fill all fields.", JsonRequestBehavior.AllowGet));
     }
 }