Пример #1
0
        public async Task SaveBookmark(SaveBookmarkRequest request)
        {
            var storageUrl = await _blobProvider.UploadFile(Constants.ContainerName, request.FilePath);

            if (!string.IsNullOrEmpty(storageUrl))
            {
                var result = await _postService.AddPostAsync(new AddPostRequest()
                {
                    Url     = request.Url,
                    BlobUrl = storageUrl
                });

                if (result.IsSuccess)
                {
                    await _bookmarkService.AddBookmarkAsync(new AddBookmarkRequest()
                    {
                        UserId = request.UserId,
                        PostId = result.Post.Id
                    });

                    await _capPublisher.PublishAsync(Constants.EmailQueue, new SendEmailRequest()
                    {
                        PostId = result.Post.Id,
                        UserId = request.UserId
                    });
                }
            }
        }
Пример #2
0
        public async Task <ActionResult <Bookmark> > AddBookmark([FromBody] AddBookmarkRequest request)
        {
            var addedBookmark = await _bookmarkService.AddBookmarkAsync(request);

            return(CreatedAtAction(nameof(GetBookmark), new { addedBookmark.Id }, addedBookmark));
        }