public EvenementImage UploadAndCreate(HttpPostedFileBase file)
        {
            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images", file.FileName);

            File.UploadHttpFile(file, path);

            var evtImage = new EvenementImage()
            {
                Title = file.FileName,
                Path  = path
            };

            evtImageRepository.Create(evtImage);

            return(evtImage);
        }
        public void Create(Evenement evt, HttpFileCollectionBase files)
        {
            var evtImageRepository = this.eventRepository.CreateRepository <EvenementImage>();

            this.eventRepository.Create(evt);

            for (var i = 0; i < files.Count; i++)
            {
                var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content", "images", files[i].FileName);
                if (File.UploadHttpFile(files[i], path))
                {
                    var evtImage = new EvenementImage()
                    {
                        Title     = files[i].FileName,
                        Path      = Path.Combine("/", "Content", "images", files[i].FileName),
                        Evenement = this.eventRepository.Find(evt.Id)
                    };
                    evtImageRepository.Create(evtImage);
                }
            }
        }
 public void Remove(EvenementImage evtImage)
 {
     Tools.File.Delete(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, evtImage.Path));
     this.evtImageRepository.Remove(evtImage);
 }
 public void Update(EvenementImage evtImage)
 {
     this.evtImageRepository.Update(evtImage);
 }
 public void Create(EvenementImage evtImage)
 {
     this.evtImageRepository.Create(evtImage);
 }