예제 #1
0
        /// <summary>
        /// Gets the timeline entry model from an idividual timeline enrty.
        /// </summary>
        /// <param name="entry">The entry.</param>
        /// <returns></returns>
        private TimelineEntryModel GetTimelineEntryModel(ITimeLine entry)
        {
            TimelineEntryModel timelineEntryModel = new TimelineEntryModel(entry);

            timelineEntryModel.User = repository.GetUser(entry.UserId);

            // Get the meme referenced by the time line entry
            timelineEntryModel.Meme = new MemeLiteModel(repository, repository.GetMeme(entry.TimeLineRefId));

            // Resolve the comment
            if (entry.EntryType == TimeLineEntry.Comment ||
                entry.EntryType == TimeLineEntry.LikeComment ||
                entry.EntryType == TimeLineEntry.DislikeComment)
            {
                IUserComment userComment = repository.GetUserComment(entry.TimeLineRefAlternateId);
                userComment.Comment = WebUtility.HtmlEncode(userComment.Comment);
                IUser user = userComment.UserId != null?repository.GetUser(userComment.UserId) : new Domain.User();

                timelineEntryModel.UserComment = new TimeLineUserCommentModel(userComment, user);
            }

            // Resolve the alternative ref id (always a meme)
            if (entry.EntryType == TimeLineEntry.Reply)
            {
                timelineEntryModel.AlternateMeme = new MemeLiteModel(repository, repository.GetMeme(entry.TimeLineRefAlternateId));
            }
            return(timelineEntryModel);
        }
예제 #2
0
        protected async void EntrySelected(TimelineEntryModel entry)
        {
            var model = new EntryStoryUpdateModel(Model.Id);

            if (entrySelectionChapter != null)
            {
                model.ChapterId = entrySelectionChapter.Id;
            }

            entrySelectionChapter = null;
            await Api.UpdateEntryStoryAsync(entry.Id, model);

            await EventDispatcher.PublishAsync(new StoryEntriesChanged(model.StoryId, model.ChapterId, entry.Id));
        }