Ejemplo n.º 1
0
        public async Task <ApiResponse <Presentation> > GetPresentationById(PresentationHeader presentationHeader)
        {
            var filePath = $"{_config.Value.PresentationPath}\\{presentationHeader.Organisation}\\{presentationHeader.Writer}\\{presentationHeader.Id}.txt";
            var serializationResponse = await _textFileManager.ReadText(filePath);

            if (serializationResponse.Status.Ok)
            {
                return(_serializer.Deserialize <Presentation>(serializationResponse.Data));
            }
            return(new ApiResponse <Presentation>()
            {
                Status = serializationResponse.Status
            });
        }
Ejemplo n.º 2
0
        public async Task <ApiResponse <List <string> > > GetPresentationByWriter(PresentationHeader presentationHeader)
        {
            var response = new ApiResponse <List <string> >();
            var filePath = $"{_config.Value.PresentationPath}\\{presentationHeader.Organisation}\\{presentationHeader.Writer}";

            try
            {
                var filesPathsList = await Task.Run(() => System.IO.Directory.GetFiles(filePath, "*.txt"));

                var filesList = filesPathsList.Select(x => Path.GetFileName(x).Replace(Path.GetExtension(x), string.Empty));
                response.Data = filesList.ToList();
            }
            catch (Exception e)
            {
                response.Status.SetError(-1, e.Message, e);
            }
            return(response);
        }
Ejemplo n.º 3
0
 public async Task <ApiResponse <List <string> > > GetPresentationByWriter([FromBody] PresentationHeader presentationHeader)
 {
     return(await _presentationManager.GetPresentationByWriter(presentationHeader));
 }
Ejemplo n.º 4
0
 public async Task <ApiResponse <Presentation> > GetPresentationById([FromBody] PresentationHeader presentationHeader)
 {
     return(await _presentationManager.GetPresentationById(presentationHeader));
 }