コード例 #1
0
        public async Task Execute(PresentationDto dto)
        {
            var conversationId = await conversations.CreateConversation(dto.Name, dto.CreatedBy);

            dto.ConversationId = conversationId;

            await presentationRepository.Create(dto);
        }
コード例 #2
0
        public async Task Create(PresentationDto dto)
        {
            await ConnectAndSetSchema();

            await connection.ExecuteAsync(
                @"INSERT INTO presentations (name, document_id, conversation_id, created_by)
                VALUES (@Name, @DocumentId, @ConversationId, @CreatedBy)",
                dto
                );
        }
コード例 #3
0
        public static PresentationDto ToPresentationDto(this Presentation presentation)
        {
            var p = new PresentationDto
            {
                _id              = presentation._id,
                Title            = presentation.Title,
                DefaultFontSize  = presentation.DefaultFontSize,
                Thumbnail        = presentation.Thumbnail,
                CreatedAt        = presentation.CreatedAt,
                PresentationJson = presentation.PresentationJson,
                ChaptersCount    = presentation.Chapters.Count
            };

            return(p);
        }
コード例 #4
0
        public async Task <IActionResult> Index(PresentationDto dto, IFormFile file)
        {
            var user = await this.GetCurrentUser();

            dto.CreatedBy = user.Id;

            var fileStream = new MemoryStream();
            await file.CopyToAsync(fileStream);

            var documentId = await uploadFileCommand.Execute(fileStream, file.FileName, user.Id);

            dto.DocumentId = documentId;
            Console.WriteLine($"Created document ${dto.DocumentId}");

            await createPresentationCommand.Execute(dto);

            return(RedirectToAction("Index", "Home"));
        }