Beispiel #1
0
        public async Task <Response <FileOutputDTO> > GetPeopleFileWithIds(IFormFile file)
        {
            try
            {
                var listPeople = await GetPeopleFromFile(file);

                var outputFile = await CreateFileWithIds(listPeople);

                var fileOutputDTO = new FileOutputDTO()
                {
                    OutputFile = outputFile
                };

                return(new Response <FileOutputDTO>()
                {
                    Status = true,
                    Message = GlobalVariables.operationCompletedMessage,
                    Data = fileOutputDTO
                });
            }
            catch (Exception ex)
            {
                return(new Response <FileOutputDTO>()
                {
                    Status = false,
                    Message = ex.Message
                });
            }
        }
Beispiel #2
0
        public async Task UpdateFile(FileOutputDTO file)
        {
            FileEntity entity = this.mapper.Map <FileEntity>(file);

            entity.isNew = false;
            await this.fileRepository.UpdateFile(entity);
        }
Beispiel #3
0
 public async Task uploadFileWithText([FromBody] FileOutputDTO file, string email)
 {
     try
     {
         await this.fileService.SaveFileWithText(file, email);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Beispiel #4
0
 public async Task UpdateFile([FromBody] FileOutputDTO file)
 {
     try
     {
         await this.fileService.UpdateFile(file);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
Beispiel #5
0
        public async Task SaveFileWithText(FileOutputDTO file, string email)
        {
            FileEntity fileToSave = new FileEntity()
            {
                OriginalName  = file.OriginalName,
                VideoFileName = Guid.NewGuid().ToString(),
                Text          = file.Text,
                UserEmail     = email,
                createdAt     = DateTime.Now,
                editedAt      = DateTime.Now,
                isNew         = true
            };

            await this.fileRepository.SaveFile(fileToSave);
        }