Ejemplo n.º 1
0
        public ActionResult Create(RoleModel model, bool continueEditing)
        {
            if (ModelState.IsValid)
            {
                var role = model.ToEntity();
                _roleService.InsertRole(role);

                SuccessNotification("添加成功");

                return continueEditing ? RedirectToAction("Edit", new { id = role.Id }) : RedirectToAction("List");
            }
            return View(model);
        }
Ejemplo n.º 2
0
 public ActionResult Create()
 {
     var model = new RoleModel();
     return View(model);
 }
Ejemplo n.º 3
0
        public ActionResult Edit(RoleModel model, bool continueEditing)
        {
            var role = _roleService.GetRoleById(model.Id);

            if (ModelState.IsValid)
            {
                role = model.ToEntity(role);
                _roleService.UpdateRole(role);

                SuccessNotification("更新成功");
                return continueEditing ? RedirectToAction("Edit", new { id = role.Id }) : RedirectToAction("List");
            }
            return View(model);
        }