示例#1
0
        public ActionResult Edit(Role role)
        {
            if (!ModelState.IsValid)
                return View(role);

            _dbContext.Entry(role).State = EntityState.Modified;
            _dbContext.SaveChanges();

            return RedirectToAction("Index", "Roles");
        }
示例#2
0
        public ActionResult Add(Role role)
        {
            if (!ModelState.IsValid)
                return View(role);

            _dbContext.Roles.Add(role);
            _dbContext.SaveChanges();

            return RedirectToAction("Index", "Roles");
        }