示例#1
0
        //Check file is already registered
        public bool FileIsAlreadyRegistered(string fileName)
        {
            var file = new FileModel
            {
                Id       = ObjectId.GenerateNewId(),
                FileName = fileName
            };

            var fileRepository = new FileRepository();
            var files          = fileRepository.GetFiles();

            if (files.Cast <FileModel>().Any(f => f.FileName == fileName))
            {
                return(true);
            }

            fileRepository.AddFileToDb(file);
            return(false);
        }