Example #1
0
        public ActionResult ViewPhoto(string photo)
        {
            photosModel = new PhotosModel(outputDir);
            PhotoInfo p = photosModel.GetPhotoInfo(photo);

            return(View(p));
        }
Example #2
0
        public ActionResult Index(string theme)
        {
            if (!string.IsNullOrWhiteSpace(theme))
            {
                string dir = Server.MapPath("content/themes/" + theme); //make sure theme dir exists
                if (Directory.Exists(dir))
                {
                    Session["theme"] = theme;
                }
            }

            string            re  = Request.RawUrl;
            GalleryRepository rep = this.GetGalleryRepository();

            ViewBag.Folders = rep.Folders;

            var photoRepository = new PhotoRepository();

            PhotosModel photosModel = new PhotosModel()
            {
                PicCount = photoRepository.GetImagesCount()
                           //    Categorieses = photoRepository.GetCategories()
            };

            ViewBag.Categories = photoRepository.GetCategories();


            ViewBag.HtmlContent = rep.RootFolder.GetHtmlContentIfAny(); //initial html content from root folder
            return(View("Index"));
        }
Example #3
0
        public ActionResult PhotosView(string id)
        {
            photosModel = new PhotosModel(outputDir);
            PhotoInfo p = photosModel.GetPhotoInfo(id);

            return(View(p)); //check that is not null
        }
Example #4
0
 /// <summary>
 /// Returns the new photos view
 /// </summary>
 /// <param name="photoView"></param>
 /// <returns></returns>
 public ActionResult ReturnFromDelete(string photoView)
 {
     // delete the photo
     this.photosModel = PhotosModel.Instance;
     foreach (PhotosModel.Photo photo in this.photosModel.photosList)
     {
         if (photo.RealRelPath == photoView)
         {
             try
             {
                 string thumbnailToDelete = photo.ThumbnailPath;
                 string pathToDelete      = photo.Path;
                 if (System.IO.File.Exists(pathToDelete))
                 {
                     int x = 5;
                 }
                 System.IO.File.Delete(thumbnailToDelete);
                 System.IO.File.Delete(pathToDelete);
                 this.photosModel.photosList.Remove(photo);
             }
             catch (Exception e) { }
             return(RedirectToAction("Photos"));
         }
     }
     return(RedirectToAction("Photos"));
 }
Example #5
0
        public ActionResult Add()
        {
            PhotoRepository rep         = this.GetPhotoRepository();
            PhotosModel     photosModel = new PhotosModel()
            {
                PicCount     = rep.GetImagesCount(),
                Categorieses = rep.GetCategories(),
                CatCount     = rep.GetCategories().Count,
            };

            return(View("Add", photosModel));
        }
Example #6
0
        //
        // GET: /Photos/

        public ViewResult Index()
        {
            var photoRepository = new PhotoRepository();

            PhotosModel photosModel = new PhotosModel()
            {
                PicCount     = photoRepository.GetImagesCount(),
                Categorieses = photoRepository.GetCategories()
            };

            return(View("IndexPhoto", photosModel));
        }
Example #7
0
        public async Task <IEnumerable <PhotosModel> > Get(int id)
        {
            IEnumerable <PhotosModel> result = new PhotosModel[] { };

            using (var client = new HttpClient())
            {
                var list = JsonConvert.DeserializeObject <List <PhotosModel> >(await client.GetStringAsync("http://jsonplaceholder.typicode.com/photos"));
                result = list.Where(x => x.albumId == id);
            }

            return(result);
        }
Example #8
0
 /// <summary>
 /// Delete a specific image (open new view to make sure the user wants to delete)
 /// </summary>
 /// <param name="photoView"></param>
 /// <returns></returns>
 public ActionResult DeleteImage(string photoView)
 {
     this.photosModel = PhotosModel.Instance;
     foreach (PhotosModel.Photo photo in this.photosModel.photosList)
     {
         if (photo.RealRelPath == photoView)
         {
             return(View(photo));
         }
     }
     return(View());
 }
        public ActionResult Photos()
        {
            if (!config.isReady)
            {
                LoadConfig();
            }
            while (!config.isReady)
            {
            }
            PhotosModel model = new PhotosModel(config.OutputDir);

            return(View(model));
        }
Example #10
0
        public static bool CheckPhotos(PhotosModel photos)
        {
            if (photos == null)
            {
                return(false);
            }

            if (photos.Photos != null && photos.Hash != null)
            {
                return(true);
            }

            return(false);
        }
Example #11
0
 /// <summary>
 /// Photoses the view.
 /// </summary>
 /// <returns>PartialViewResult.</returns>
 public PartialViewResult PhotosDelete(string id)
 {
     removedPhoto = id;
     photosModel  = new PhotosModel(outputDir);
     return(PartialView("PhotosDelete", id)); //check that is not null
 }
 public ActionResult Photos(string oauth_token, string oauth_verifier, string q)
 {
     if (Session[OAuthSessionKey] == null)
     {
         Session[OAuthSessionKey] = OAuthService.GetOAuthUser(oauth_token, oauth_verifier);
     }
     var user = Session[OAuthSessionKey] as IOAuthUser;
     var photos = PhotoService.GetPhotos(user, (q ?? String.Empty));
     var alltags = PhotoService.GetAllTags(user);
     var photosmodel = new PhotosModel { Owner = user, Photos = photos, Tags = alltags };
     return View(photosmodel);
 }
        public ActionResult Photos()
        {
            PhotosModel model = new PhotosModel();

            return(View(model));
        }
 /// <summary>
 /// photos page view.
 /// </summary>
 /// <returns></returns>
 public ActionResult PhotosView()
 {
     configModel.getConfig();
     photosModel = new PhotosModel(configModel.OutputDirectory);
     return(View(photosModel));
 }
Example #15
0
 /// <summary>
 /// Returns all the photos in the thumbnail view.
 /// </summary>
 /// <returns></returns>
 public ActionResult Photos()
 {
     this.photosModel = PhotosModel.Instance;
     this.photosModel.Initialize();
     return(View(this.photosModel.photosList));
 }
Example #16
0
 public ActionResult Photos()
 {
     photosModel = new PhotosModel(outputDir);
     return(View(photosModel));
 }
Example #17
0
 public ActionResult OnDeletePhoto()
 {
     photosModel = new PhotosModel(outputDir);
     photosModel.RemovePhoto(removedPhoto);
     return(RedirectToAction("Photos", photosModel));
 }
Example #18
0
        //
        // GET: /Photos/

        public ActionResult Index()
        {
            PhotosModel model = new PhotosModel();

            return(View(model.PhotosByParentId().ToList()));
        }
Example #19
0
 public virtual void Initialize(Context context)
 {
     this.context = context;
     PhotosModel  = new PhotosModel(Database);
     DownloadedElevationDataModel = new DownloadedElevationDataModel(Database);
 }
Example #20
0
 /// <summary>
 /// Consturctor.
 /// </summary>
 public PhotosController()
 {
     photosModel = new PhotosModel();
 }