Пример #1
0
        public async Task <bool> WatchStory(string storyId, string userId)
        {
            var story = await database.StoryRepository.FindById(storyId) ??
                        throw new EntityNotFoundException("Story not found");

            if (story.UserStories.Any(us => us.UserId == userId))
            {
                return(true);
            }

            var userStory = UserStory.Create(story.Id, userId);

            story.UserStories.Add(userStory);

            return(await database.Complete());
        }