コード例 #1
0
        public ActionResult Copy(CopyRoleModel model, string submitButton, string ddlRoleName)
        {
            //check the other submit buttons and act on them, or continue
            switch (submitButton)
            {
            case "Cancel":
                return(RedirectToAction("Index", "Roles"));
            }

            //case "Copy Role":
            try
            {
                var authMan = new AuthorizationManager(model.CustomerInternalName);
                int groupID = authMan.CloneAuthorizationList(ddlRoleName, model.ToRoleName);

                //then save it back to the DB
                int userID = WebSecurity.CurrentUserId;
                (new AuditFactory()).CreatedBy(Constants.Audits.RoleTableName, groupID, userID);

                return(RedirectToAction("Index", "Roles"));
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", "Could not copy role .");
            }
            //// If we got this far, something failed, redisplay form
            return(View(model));
        }
コード例 #2
0
        public ActionResult Copy(string roleName)
        {
            ViewBag.RoleName = roleName;
            var roleModel = new CopyRoleModel
            {
                CustomerName         = CurrentCity.DisplayName,
                CustomerId           = CurrentCity.Id,
                CustomerInternalName = CurrentCity.InternalName
            };

            return(View(roleModel));
        }