Example #1
0
        public async Task OnExecute()
        {
            _commandUtil.PrintTitle("Creación de Usuario");
            var name     = _commandUtil.PromptString("Nombre:");
            var email    = _commandUtil.PromptString("Email:");
            var password = _commandUtil.PromptPassword("Contraseña:");

            var command = new CreateUserCommand()
            {
                Name       = name,
                Email      = email,
                Password   = password,
                TenantCode = "",
                RoleCode   = GeneralConstants.RoleUser,
            };

            try
            {
                var user = await _mediator.Send(command);

                _commandUtil.Print($"Usuario Creado: {user.Id}", ConsoleColor.Green);
            }
            catch (Exception e)
            {
                _commandUtil.PrintException(e);
            }
        }
Example #2
0
        public async Task OnExecute()
        {
            _commandUtil.PrintTitle("Lista de Usuarios");

            var search = _commandUtil.PromptString("Búsqueda (q! para salir): ");

            while (search != "q!")
            {
                var page = _commandUtil.PromptInt("Página", defaultAnswer: 1);

                var queryString = $"sort=-updatedAt&search=pattern:{search}";
                var userData    = new UserData();
                var request     = new PaginationRequest()
                {
                    Limit = DefaultLimit, Page = page
                };
                var queryBag  = QueryBag.Of(queryString, userData);
                var paginated = await _userQuery.Paginated(request, queryBag);

                PrintUsersDataTable(paginated);

                search = _commandUtil.PromptString("Búsqueda (q! para salir): ");
            }
        }