Beispiel #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
            });
        }
Beispiel #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);
        }
Beispiel #3
0
 public async Task <ApiResponse <List <string> > > GetPresentationByWriter([FromBody] PresentationHeader presentationHeader)
 {
     return(await _presentationManager.GetPresentationByWriter(presentationHeader));
 }
Beispiel #4
0
 public async Task <ApiResponse <Presentation> > GetPresentationById([FromBody] PresentationHeader presentationHeader)
 {
     return(await _presentationManager.GetPresentationById(presentationHeader));
 }