Пример #1
0
 public ActionResult Create(State state)
 {
     if (ModelState.IsValid) {
         stateRepository.InsertOrUpdate(state);
         stateRepository.Save();
         return RedirectToAction("Index");
     } else {
         ViewBag.PossibleCountries = countryRepository.All;
         return View();
     }
 }
Пример #2
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;
 }
Пример #3
0
 public void InsertOrUpdate(State state)
 {
     if (state.StateID == default(int)) {
         // New entity
         context.State.Add(state);
     } else {
         // Existing entity
         context.Entry(state).State = EntityState.Modified;
     }
 }
Пример #4
0
 public ViewResult Search(State searchState)
 {
     if(searchState!=null)
     {
                     }
                 return View("Index",stateRepository.AllIncluding(state => state.Country));
 }