Exemple #1
0
        public ActionResult Delete(string Id)
        {
            try
            {
                Photo model = photoRepository.GetPhotoFromDbById(new Guid(Id));
                if (model.UserID == userID)
                {
                    photoRepository.DeletePhotoFromDB(model);

                    string fullPath = Request.MapPath(model.Path);

                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
            }
            catch
            {
            }
            List <Photo> photosFromDB = photoRepository.GetPhotoFromDbByUserId(userID);
            ICollection <IndexPhotoViewModels> models = new List <IndexPhotoViewModels>();

            photosFromDB.ForEach(x => models.Add(PhotoMapper.MapIndexPhotoViewModel(x)));


            return(PartialView("_Images", models));
        }
Exemple #2
0
        public ActionResult AlbumPhotoes(string id)
        {
            List <Photo> photosFromDB         = photoRepository.GetAllPhotoesInAlbumByID(id);
            List <IndexPhotoViewModel> photos = new List <IndexPhotoViewModel>();

            photosFromDB.ForEach(x => photos.Add(PhotoMapper.MapIndexPhotoViewModel(x)));
            return(PartialView("_thumbnails", photos));
        }
Exemple #3
0
        // GET: User/Edit
        public ActionResult Index()
        {
            List <Photo> photosFromDB = photoRepository.GetPhotoFromDbByUserId(userID);
            ICollection <IndexPhotoViewModels> model = new List <IndexPhotoViewModels>();

            photosFromDB.ForEach(x => model.Add(PhotoMapper.MapIndexPhotoViewModel(x)));

            return(View(model));
        }
Exemple #4
0
        public ActionResult Index()
        {
            List <Photo> photosFromDB         = photoRepository.GetAllPhotosFromDb();
            List <IndexPhotoViewModel> photos = new List <IndexPhotoViewModel>();

            photosFromDB.ForEach(x => photos.Add(PhotoMapper.MapIndexPhotoViewModel(x)));

            return(View(photos));
        }
Exemple #5
0
        public ActionResult Data()
        {
            var model = new DataViewModel()
            {
                users    = userRepository.GetAllUsers().Count().ToString(),
                albums   = albumRepository.GettAllAlbums().Count().ToString(),
                comments = commentRepository.GetAllComments().Count().ToString(),
                photos   = photoRepository.GetAllPhotosFromDb().Count().ToString(),
                latest   = PhotoMapper.MapIndexPhotoViewModel(photoRepository.GetLastAddedPhoto()).Path
            };

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Exemple #6
0
 public ActionResult Media(string Search, string Filter)
 {
     if (Filter == "photo")
     {
         List <Photo> photosFromDB         = photoRepository.GetSearchPhotosFromDb(Search);
         List <IndexPhotoViewModel> photos = new List <IndexPhotoViewModel>();
         photosFromDB.ForEach(x => photos.Add(PhotoMapper.MapIndexPhotoViewModel(x)));
         return(PartialView("_thumbnails", photos));
     }
     else
     {
         List <Album>          albumsFromDB = albumRepository.GetSearchAlbumsFromDB(Search).Where(x => x.Photos.Count() > 0).ToList();
         List <AlbumViewModel> albums       = new List <AlbumViewModel>();
         albumsFromDB.ForEach(x => albums.Add(AlbumMapper.MapAlbumViewModel(x, photoRepository)));
         return(PartialView("_thumbnailsAlbum", albums));
     }
 }