コード例 #1
0
        public ActionResult Save(UserFormViewModel user)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("New", "User"));
            }
            _userAppService.DeleteUserApps(user.BlazerId);
            _userRoleService.DeleteUserRole(user.BlazerId);

            var roleIds = user.AppRoles.Select(x => x.Id).ToList();
            var appIds  = user.Apps.Select(x => x.Id).ToList();

            _userAppService.AddUserApps(user.BlazerId, appIds, roleIds);
            _userRoleService.AddUserRole(user.BlazerId, user.RoleId);

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