Example #1
0
        public void GetRolesTest()
        {
            GetRolesCommand getRolesCommand = new GetRolesCommand();

            getRolesCommand.Execute();
            var roles = getRolesCommand.GetResult();

            //var roles = RoleRepository.GetRoles();
            Assert.AreEqual(5, roles.Count);
        }
Example #2
0
        public ActionResult <IEnumerable <Role> > GetRoles()
        {
            var roles    = new List <Role>();
            var rolesDTO = new List <RoleDTO>();

            try
            {
                //  _logger.LogInformation("Ejecutando el Comando GetRolesCommand()");
                GetRolesCommand command = CommandFactory.CreateGetRolesCommand();
                command.Execute();
                //  _logger.LogInformation("Ejecutado el Comando GetRolesCommand()");
                roles = command.GetResult();
                RoleMapper mapper = new RoleMapper();
                rolesDTO = mapper.CreateDTOList(roles);
            }
            catch (DatabaseException e)
            {
                // _logger.LogError("BadRequest: ", e);
                return(BadRequest("Error al Obtener Roles"));
            }

            return(Ok(rolesDTO));
        }