public IActionResult SaveZipFiles(IEnumerable <ZipFileViewModel> model)
        {
            var repo     = new ZipFileRepo();
            var fileList = new List <ZipFileDetailDto>();
            var key      = configuration.GetSection("AppSettings").GetSection("EncKey").Value;

            foreach (var item in model)
            {
                fileList.Add(new ZipFileDetailDto {
                    FileName    = EncryptDecryptString.Decrypt(item.Name, key),
                    IsDerectory = item.IsFolder
                });
            }

            var fileHeader = new ZipFileHeaderDto()
            {
                FileName       = fileList[0].FileName,
                ZipFileDetails = fileList
            };

            repo.SaveFile(fileHeader);
            return(Ok());
        }
Example #2
0
        public int SaveFile(ZipFileHeaderDto zipFileDto)
        {
            var objFileHeader = Query <ZipFileHeader>().Where(t => t.FileName == zipFileDto.FileName).FirstOrDefault();

            if (objFileHeader == null)
            {
                var newProduct = new ZipFileHeader {
                    FileName    = zipFileDto.FileName,
                    CreatedDate = DateTime.Now,
                    CreatedUser = 1,
                    IsActive    = true
                };
                SaveFileDetails(zipFileDto.ZipFileDetails, newProduct);
                Insert(newProduct);
            }
            else
            {
                objFileHeader.FileName    = zipFileDto.FileName;
                objFileHeader.UpdatedDate = DateTime.Now;
                objFileHeader.UpdatedUser = 2;
            }
            SaveChenge();
            return(-1);
        }