public async Task Execute(PresentationDto dto) { var conversationId = await conversations.CreateConversation(dto.Name, dto.CreatedBy); dto.ConversationId = conversationId; await presentationRepository.Create(dto); }
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 ); }
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); }
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")); }