Exemplo n.º 1
0
        public override GetModulesByUserIdResponse OnGetModulesByUserIdExecute(GetModulesByUserIdRequest request)
        {
            GetModulesByUserIdResponse response = new GetModulesByUserIdResponse();

            try
            {
                var parentsSpec    = new ModulosParentsSpec();
                var parentsModules = _moduloRepository.Query(parentsSpec);

                var spec          = new ModulosByUserIdSpec(request.Id);
                var modulesByUser = _moduloRepository.GetModulosByUserId(spec);

                response.Modulos = _moduloFactory.CreateListModules(parentsModules, modulesByUser);
            }
            catch (Exception ex)
            {
                response.Exception = ex;
            }
            return(response);
        }