コード例 #1
0
        public void AddUser(int userID, int roleID)
        {
            IRoleService         service = this.CreateSubClient();
            ICommunicationObject comm    = service as ICommunicationObject;

            comm.Using(client =>
            {
                service.AddUser(userID, roleID);
            });
        }
コード例 #2
0
        public async Task <IActionResult> AddUser(InsertRoleUserModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await _roleService.AddUser(model);

                if (result.IsSuccess)
                {
                    StatusMessage = SuccessNotifcation("Insert user success!");
                    return(RedirectToAction("AddUser", "Role", new
                    {
                        id = model.RoleId
                    }));
                }

                ModelState.AddModelError("", result.Message);
            }

            ViewBag.Users = await _userService.GetWithoutRoleId(model.RoleId);

            return(View(model));
        }