Exemplo n.º 1
0
 public void Convert(string fileType, string fileName)
 {
     if (fileType == "doc")
     {
         fileConvertor = new DocConvertor();
         fileConvertor.ConvertToDoc(fileName);
     }
     else if (fileType == "pdf")
     {
         fileConvertor = new PdfConvertor();
         fileConvertor.ConvertToPdf(fileName);
     }
 }
Exemplo n.º 2
0
        public IActionResult Post([FromForm] IFormFile file, [FromServices] IFileConvertor fileConvertor, [FromServices] IImportEmployees importEmployees)
        {
            var result = importEmployees.Execute(new FileUpload()
            {
                FileBytes = fileConvertor.Convert(file)
            });

            if (result.Success)
            {
                return(Ok(result.Message));
            }

            return(BadRequest(result.Message));
        }