public ActionResult Create(Region region) { if (ModelState.IsValid) { regionRepository.InsertOrUpdate(region); regionRepository.Save(); return RedirectToAction("Index"); } else { return View(); } }
public void InsertOrUpdate(Region region) { if (region.RegionID == default(int)) { // New entity context.Region.Add(region); } else { // Existing entity context.Entry(region).State = EntityState.Modified; } }
public ViewResult Search(Region searchRegion) { if(searchRegion!=null) { } return View("Index",regionRepository.All); }
public ActionResult Create() { Region region = new Region(); return View(region); }