Exemplo n.º 1
0
        private static async Task<MediaAlbum> EnsureTimelinePhotoAlbumExistsAsync(
            ApplicationDbContext dbContext,
            UserInfo userEntity)
        {
            if (!userEntity.TimelineImagesMediaAlbumId.HasValue)
            {
                var timelineAlbum = new MediaAlbum
                {
                    User = userEntity,
                    Title = "Timeline Photos",
                    Description = "Photos posted to my timeline"
                };
                userEntity.TimelineImagesAlbum = timelineAlbum;
                dbContext.MediaAlbums.Add(timelineAlbum);

                await dbContext.SaveChangesAsync();

                return timelineAlbum;
            }

            if (userEntity.TimelineImagesAlbum == null)
            {
                await dbContext.Entry(userEntity).Reference(u => u.TimelineImagesAlbum).LoadAsync();
            }

            return userEntity.TimelineImagesAlbum;
        }
Exemplo n.º 2
0
        public static async Task NotifyMentionsAsync(
            ApplicationDbContext dbContext,
            string mentionedIn,
            string mentioningUserId,
            UserText text)
        {
            await dbContext.Entry(text).Collection(t => t.MentionsUser).LoadAsync();

            if (text.MentionsUser != null && text.MentionsUser.Count > 0)
            {
                // TBD
            }
        }