Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }