Beispiel #1
0
        public async Task <IEnumerable <VisitorDto> > HandleAsync(GetVisitorsOnSite query)
        {
            var visitors = await _visitorsRepository.GetForSiteAsync(query.SiteId);


            var visitorDocuments = visitors.ToList();

            if (!visitorDocuments.Any())
            {
                return(null);
            }


            Guid nameSpecId =
                await _specificationRepository.GetNameSpecIdForBusinessAsync(
                    visitorDocuments.First().VisitingBusinessId);

            return(visitorDocuments.Select(v => new VisitorDto
            {
                Id = v.Id,
                Name = v.Data.First(spec => spec.DataSpecificationId == nameSpecId).Value,
                InAt = v.In.ToShortTimeString()
            }));
        }