Example #1
0
        public void CreateEcole(Ecole oldEcole, Ecole newEcole)
        {
            string filename = null;

            if (!string.IsNullOrEmpty(newEcole.Logo))
            {
                string ext = Path.GetExtension(newEcole.Logo);
                filename = Guid.NewGuid().ToString() + ext;
                FileInfo fileSource = new FileInfo(newEcole.Logo);
                string   filePath   = Path.Combine(dbFolder, "logo", filename);
                FileInfo fileDest   = new FileInfo(filePath);
                if (!fileDest.Directory.Exists)
                {
                    fileDest.Directory.Create();
                }
                fileSource.CopyTo(fileDest.FullName);
            }
            newEcole.Logo = filename;
            ecoleRepo.Add(newEcole);

            if (!string.IsNullOrEmpty(oldEcole.Logo))
            {
                File.Delete(oldEcole.Logo);
            }
        }
Example #2
0
 public void CreateEcole(Ecole ecole)
 {
     ecoleRepo.Add(ecole);
 }
Example #3
0
 public void CreateEtudiant(Ecole ecole)
 {
     ecoleRepo.Add(ecole);
 }