예제 #1
0
        public ActionResult Create(Permission permission)
        {
            try
            {
                // TODO: Add insert logic here
                if(ModelState.IsValid)
                {
                    db.Permissions.Add(permission);
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }

                return View(permission);
            }
            catch
            {
                return View();
            }
        }
예제 #2
0
        public ActionResult Edit(int id, Permission permission)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    db.Entry(permission).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }

                return View(permission);
            }
            catch
            {
                return View();
            }
        }