예제 #1
0
        public ActionResult Edit(Region region, int? page = 1, int? count = __default_count)
        {
            ViewBag.Page = page = page.HasValue && page > 1 ? page : 1;
            ViewBag.Count = count = count.HasValue && count > __default_count ? count : __default_count;

            if (ModelState.IsValid)
            {
                DB.Entry(region).State = EntityState.Modified;
                DB.SaveChanges();
                return RedirectToAction("Index", new { count = count, page = page });
            }
            return View(region);
        }
예제 #2
0
        public ActionResult Create(Region region, int? page = 1, int? count = __default_count)
        {
            ViewBag.Page = page = page.HasValue && page > 1 ? page : 1;
            ViewBag.Count = count = count.HasValue && count > __default_count ? count : __default_count;

            if (ModelState.IsValid)
            {
                DB.Regions.Add(region);
                DB.SaveChanges();
                return RedirectToAction("Index", new { count = count, page = page });
            }

            return View(region);
        }