コード例 #1
0
ファイル: RoleEditCommand.cs プロジェクト: bhbk/x9et3y6s
        public override int Run(string[] remainingArguments)
        {
            try
            {
                if (_isEnabled.HasValue)
                {
                    _role.IsEnabled = _isEnabled.Value;
                }

                if (_isDeletable.HasValue)
                {
                    _role.IsDeletable = _isDeletable.Value;
                }

                var role = _service.Role_UpdateV1(_map.Map <RoleV1>(_role))
                           .Result;

                FormatOutput.Roles(_uow, new List <E_Role> {
                    _map.Map <E_Role>(role)
                }, true);

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }
コード例 #2
0
ファイル: RoleDeleteCommand.cs プロジェクト: bhbk/x9et3y6s
        public override int Run(string[] remainingArguments)
        {
            try
            {
                FormatOutput.Roles(_uow, new List <E_Role> {
                    _role
                });
                Console.Out.WriteLine();

                Console.Out.Write("  *** Enter 'yes' to delete role *** : ");
                var input = StandardInput.GetInput();
                Console.Out.WriteLine();

                if (input.ToLower() == "yes")
                {
                    _ = _service.Role_DeleteV1(_role.Id)
                        .Result;
                }

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }
コード例 #3
0
ファイル: RoleShowAllCommand.cs プロジェクト: bhbk/x9et3y6s
        public override int Run(string[] remainingArguments)
        {
            try
            {
                var expression = QueryExpressionFactory.GetQueryExpression <E_Role>();

                if (!string.IsNullOrEmpty(_filter))
                {
                    expression = expression.Where(x => x.Name.Contains(_filter));
                }

                _roles = _uow.Roles.Get(expression.ToLambda(),
                                        new List <Expression <Func <E_Role, object> > >()
                {
                    x => x.AudienceRoles,
                    x => x.RoleClaims,
                    x => x.UserRoles,
                })
                         .TakeLast(_count);

                FormatOutput.Roles(_uow, _roles.OrderBy(x => x.Name));

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }
コード例 #4
0
ファイル: RoleShowCommand.cs プロジェクト: bhbk/x9et3y6s
        public override int Run(string[] remainingArguments)
        {
            try
            {
                FormatOutput.Roles(_uow, new List <E_Role> {
                    _role
                }, true);

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }
コード例 #5
0
ファイル: RoleCreateCommand.cs プロジェクト: bhbk/x9et3y6s
        public override int Run(string[] remainingArguments)
        {
            try
            {
                var role = _service.Role_CreateV1(
                    new RoleV1()
                {
                    AudienceId  = _audience.Id,
                    Name        = _roleName,
                    IsEnabled   = true,
                    IsDeletable = true,
                }).Result;

                FormatOutput.Roles(_uow, new List <E_Role> {
                    _map.Map <E_Role>(role)
                });

                return(StandardOutput.FondFarewell());
            }
            catch (Exception ex)
            {
                return(StandardOutput.AngryFarewell(ex));
            }
        }