Ejemplo n.º 1
0
        public async Task <List <CourseDto> > GetCourses(NoInput input)
        {
            List <CourseDto> coursesDto = new List <CourseDto>();
            var courses = await _context.Courses.ToListAsync();

            if (courses != null)
            {
                coursesDto = Mapper.Map <List <CourseDto> >(courses);
            }

            return(coursesDto);
        }
Ejemplo n.º 2
0
        public async Task <List <StudentDto> > GetStudents(NoInput input)
        {
            List <StudentDto> studentsDto = new List <StudentDto>();
            var students = await _context.Students.ToListAsync();

            if (students != null)
            {
                studentsDto = Mapper.Map <List <StudentDto> >(students);
            }

            return(studentsDto);
        }
Ejemplo n.º 3
0
        public override Task <QueryResult <List <KnownEndpointsView> > > LocalQuery(Request request, NoInput input)
        {
            var result = EndpointInstanceMonitoring.GetKnownEndpoints();

            return(Task.FromResult(new QueryResult <List <KnownEndpointsView> >(result, new QueryStatsInfo(string.Empty, result.Count))));
        }
Ejemplo n.º 4
0
        public override async Task <QueryResult <IList <KnownEndpointsView> > > Query(Request request, NoInput input)
        {
            using (var session = Store.OpenAsyncSession())
            {
                var endpoints = await session.Query <EndpointDetails, EndpointsIndex>()
                                .Statistics(out var stats)
                                .ToListAsync()
                                .ConfigureAwait(false);

                var knownEndpoints = endpoints
                                     .Select(x => new KnownEndpointsView
                {
                    Id = DeterministicGuid.MakeId(x.Name, x.HostId.ToString()),
                    EndpointDetails = x,
                    HostDisplayName = x.Host
                })
                                     .ToList();

                return(new QueryResult <IList <KnownEndpointsView> >(knownEndpoints, stats.ToQueryStatsInfo()));
            }
        }