Exemplo n.º 1
0
        public void Create(EntityType entityType, int entityId, ModelCollection <FileEntity> files)
        {
            if (files == null || files.Count == 0)
            {
                return;
            }

            using (DatabaseContext context = CreateDatabaseContext())
            {
                FileRepository            fileRepository = new FileRepository(context);
                IEnumerable <VEntityFile> created        = fileRepository.Create(entityType, entityId, files);
                context.SaveChanges();
                foreach (IFile file in created)
                {
                    files.Single(x => string.Equals(x.SystemFileName, file.SystemFileName)).FileId = file.FileId;
                }
            }
        }