Ejemplo n.º 1
0
 public ActionResult Create(Country country)
 {
     if (ModelState.IsValid) {
         countryRepository.InsertOrUpdate(country);
         countryRepository.Save();
         return RedirectToAction("Index");
     } else {
         return View();
     }
 }
Ejemplo n.º 2
0
 public void InsertOrUpdate(Country country)
 {
     if (country.CountryID == default(int)) {
         // New entity
         context.Country.Add(country);
     } else {
         // Existing entity
         context.Entry(country).State = EntityState.Modified;
     }
 }
Ejemplo n.º 3
0
 public static string GetLocation(string strCityName, State state, Country country)
 {
     string strLocation = strCityName.ToString(true).Trim();
     if (state != null && state.Name.IsNotNullOrEmpty())
     {
         strLocation = strLocation.Concate(", ", state.Name.Trim());
     }
     if (country != null && country.Name.IsNotNullOrEmpty())
     {
         strLocation = strLocation.Concate(", ", country.Name.Trim());
     }
     return strLocation;
 }
Ejemplo n.º 4
0
 public ViewResult Search(Country searchCountry)
 {
     if(searchCountry!=null)
     {
                     }
                 return View("Index",countryRepository.All);
 }