Ejemplo n.º 1
0
        public async Task <IActionResult> Detail(Guid eventId)
        {
            var cancellationToken = GetCancellationToken();
            var familyEvent       = await _readmodel.Load(eventId, cancellationToken);

            var gallery = await _galleryReadRepository.FindAllByFamilyEvent(familyEvent.ID, cancellationToken);

            var imageReference = (await _imageReferenceReadRepository.LoadByGallery(gallery.FirstOrDefault(g => g.DefaultFamilyEventGallery).ID, cancellationToken)).FirstOrDefault(ir => ir.DefaultGalleryImage);

            return(View(Models.FamilyEvent.MapWithImageReference(familyEvent, imageReference.ID, gallery.FirstOrDefault(g => g.DefaultFamilyEventGallery).ID, imageReference.Title)));
        }
Ejemplo n.º 2
0
        public static async Task <GalleryIndex> Map(Repo.Core.Model.Gallery sourceGallery, ClanAndPeopleService clanAndFamilyService, IFamilyEventReadRepository familyEventReadModel, CancellationToken cancellationToken)
        {
            var familyName = sourceGallery.FamilyId.HasValue ?
                             $"{clanAndFamilyService.Clans.FirstOrDefault(c => c.Id == sourceGallery.FamilyId)?.FamilyName}, {clanAndFamilyService.Clans.FirstOrDefault(c => c.Id == sourceGallery.FamilyId)?.Family}"
                                : string.Empty;

            return(await Task.FromResult(new GalleryIndex()
            {
                Title = sourceGallery.Name,
                FamilyEvent = FamilyEvent.Map(await familyEventReadModel.Load(sourceGallery.FamilyEvent, cancellationToken)),
                Owner = sourceGallery.Owner.ToString(),
                OwnerId = sourceGallery.Owner,
                Summary = sourceGallery.Summary,
                Id = sourceGallery.ID,
                DateCreated = sourceGallery.DateCreated,
                Family = familyName,
                DefaultFamilyEventGallery = sourceGallery.DefaultFamilyEventGallery,
                GalleryDate = sourceGallery.GalleryDate,
                Clan = clanAndFamilyService.Clans.FirstOrDefault(t => t.Id == sourceGallery.FamilyId)
            }
                                         ));
        }