public ActionResult Create(Zone zone) { if (ModelState.IsValid) { List<Zone> zo2ne = context.Zones.Where(aa => aa.ZoneName == "Central Zone").ToList(); context.Zones.Add(zone); context.SaveChanges(); return RedirectToAction("Index"); } return View(zone); }
public ActionResult Edit(Zone zone) { if (ModelState.IsValid) { List<Region> region = new List<Region>(); region = context.Regions.Where(aa => aa.ZoneID == zone.ZoneID).ToList(); foreach (var re in region) { re.ZoneName = zone.ZoneName; context.SaveChanges(); } context.Entry(zone).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return RedirectToAction("Index"); } return View(zone); }