Exemplo n.º 1
0
        public IActionResult Get(int id)
        {
            var presentation = repo.Get(id);

            if (presentation == null)
            {
                return(NotFound());
            }

            return(new ObjectResult(presentation));
        }
Exemplo n.º 2
0
        // GET: Presentations/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var presentation = await _presentationRepository.Get((int)id);

            if (presentation == null)
            {
                return(NotFound());
            }

            return(View(presentation));
        }
        public PresentationDto Read(int id)
        {
            try
            {
                var presentation = _presentationRepository.Get(id);

                if (presentation != null)
                {
                    presentation.Chapters = _chapterService.ReadByPresentationId(id);
                    return(presentation.ToPresentationDto());
                }

                return(new PresentationDto());
            }
            catch (Exception)
            {
                return(new PresentationDto());
            }
        }
Exemplo n.º 4
0
        public ActionResult <PresentationResource> Get(int id)
        {
            var presentation = repo.Get(id);

            if (presentation == null)
            {
                return(NotFound());
            }

            return(new PresentationResource(presentation).EmbedRelations(Request, embeddedRelationsSchema));
        }
Exemplo n.º 5
0
        public IActionResult Presentation(string googleDriveFileId)
        {
            try
            {
                var presentation = _presentationRepository.Get(googleDriveFileId);
                var pptxMergedFileOnLocalhost = _googleSlides.DownloadPptx(presentation, googleDriveFileId);

                var zippedPresentationOnLocalhost = _pptxToZipConverter.Convert(pptxMergedFileOnLocalhost);
                var zippedPresentation            = _googleSlides.AddZipFile(zippedPresentationOnLocalhost);

                var response = CreateResponseForZipAndHistoryLog(zippedPresentation, presentation);

                System.IO.File.Delete(pptxMergedFileOnLocalhost);
                System.IO.File.Delete(zippedPresentationOnLocalhost);
                return(Ok(response));
            }
            catch (Exception ex)
            {
                var presentationResponse = new PresentationResponse();
                presentationResponse.CreateExceptionResponse(null, ex.Message);
                return(BadRequest(presentationResponse));
            }
        }
Exemplo n.º 6
0
        public async Task <IActionResult> PostQuestion([FromBody] QuestionModel questionModel)
        {
            var presentation = await _presentationRepository.Get(questionModel.Presentation);

            Question question = new Question()
            {
                Presentation = presentation,
                Correct      = questionModel.Correct,
                Options      = questionModel.Options,
                Sentence     = questionModel.Sentence,
                Slide        = questionModel.Slide
            };
            await _questionRepository.Create(question);

            return(await Questions(question.Presentation.Id));
        }
        public async Task <ViewPresentationDto> Fetch(long presentationId)
        {
            var presentation = await presentationRepository.Get(presentationId);

            var url = retrieveDocumentUrlQuery.GetDocumentUrlFromAwsKey(presentation.awsKey);

            var dto = new ViewPresentationDto
            {
                PresentationId   = presentationId,
                Schema           = currentSchema.Name,
                Url              = url,
                PresentationName = presentation.Name,
                ConversationId   = presentation.ConversationId,
                Status           = presentation.Status
            };

            return(dto);
        }
Exemplo n.º 8
0
        // TODO handle errors
        private int AddToRepo(ServerResource serverResource)
        {
            var server = new Model.Server
            {
                Name        = serverResource.Name,
                Description = serverResource.Description,
                AuthorId    = userManager.Users.First().Id // TODO current user
            };

            foreach (var link in serverResource.Links.Where(l => l.Rel == LinkTemplates.Servers.GetSimulations.Rel))
            {
                server.AddSimulation(simulationsRepo.Get(link.GetId()));
            }

            foreach (var link in serverResource.Links.Where(l => l.Rel == LinkTemplates.Servers.GetPresentations.Rel))
            {
                server.AddPresentation(presentationsRepo.Get(link.GetId()));
            }

            serversRepo.Add(server);
            return(server.Id);
        }