public IActionResult Zip(string ids, string algo = "")
        {
            Paramaters    paramaters = new Paramaters(_context);
            string        pathStyle  = paramaters.getEmpParam(simplifile.Services.ParamsKeys.E18, "", "");
            List <string> lista      = new List <string>();
            var           separados  = ids.Split(',');

            lista = separados.ToList();
            List <FileBasic> sourceFiles = new List <FileBasic>();

            List <CFDIDatos> datos = new List <CFDIDatos>();

            foreach (var uuid in lista)
            {
                CFDIDatos dato = _context.CFDIs.FirstOrDefault(d => d.CfdUUID == uuid);
                if (dato != null && dato.CfdXml != null)
                {
                    datos.Add(dato);
                }
            }
            //los adjunto como xml
            string extension = "xml";

            foreach (var item in datos)
            {
                sourceFiles.Add(new FileBasic
                {
                    FileStream = item.CfdXml,
                    filename   = item.CfdUUID,
                    extension  = extension
                });
            }
            //los adjunto como pdf...
            extension = "pdf";
            foreach (var item in datos)
            {
                sourceFiles.Add(new FileBasic
                {
                    FileStream = FilesTransform.generatePDF(item.CfdUUID, pathStyle, _context, _environment),
                    filename   = item.CfdUUID,
                    extension  = extension
                });
            }
            string password = Guid.NewGuid().ToString("d").Substring(1, 6);
            var    response = FilesTransform.GetZIPStream(sourceFiles, password);

            SendPasswordEmail(User.Identity.Name, User.Identity.Name, password);
            return(File(response, "application/zip", DateTime.Now.ToShortDateString() + ".zip"));
        }
        public IActionResult XMLZip(string ids, string algo = "")
        {
            List <string> lista     = new List <string>();
            var           separados = ids.Split(',');

            lista = separados.ToList();
            List <FileBasic> sourceFiles = new List <FileBasic>();

            List <CFDIDatos> datos = new List <CFDIDatos>();

            foreach (var uuid in lista)
            {
                CFDIDatos dato = _context.CFDIs.FirstOrDefault(d => d.CfdUUID == uuid);
                if (dato != null && dato.CfdXml != null)
                {
                    datos.Add(dato);
                }
            }

            string extension = "xml";

            foreach (var item in datos)
            {
                sourceFiles.Add(new FileBasic
                {
                    FileStream = item.CfdXml,
                    filename   = item.CfdUUID,
                    extension  = extension
                });
            }
            string password = Guid.NewGuid().ToString("d").Substring(1, 6);

            byte[] fileBytes2 = FilesTransform.GetZIPStream(sourceFiles, password);
            SendPasswordEmail(User.Identity.Name, User.Identity.Name, password);
            return(File(fileBytes2, "application/zip", "Archivos.zip"));
        }