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

            return(View(p));
        }
Exemplo n.º 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"));
        }
Exemplo n.º 3
0
        public ActionResult PhotosView(string id)
        {
            photosModel = new PhotosModel(outputDir);
            PhotoInfo p = photosModel.GetPhotoInfo(id);

            return(View(p)); //check that is not null
        }
Exemplo n.º 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"));
 }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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());
 }
Exemplo n.º 9
0
        public ActionResult Photos()
        {
            if (!config.isReady)
            {
                LoadConfig();
            }
            while (!config.isReady)
            {
            }
            PhotosModel model = new PhotosModel(config.OutputDir);

            return(View(model));
        }
Exemplo n.º 10
0
        public static bool CheckPhotos(PhotosModel photos)
        {
            if (photos == null)
            {
                return(false);
            }

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

            return(false);
        }
Exemplo n.º 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
 }
Exemplo n.º 12
0
 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));
 }
Exemplo n.º 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));
 }
Exemplo n.º 16
0
 public ActionResult Photos()
 {
     photosModel = new PhotosModel(outputDir);
     return(View(photosModel));
 }
Exemplo n.º 17
0
 public ActionResult OnDeletePhoto()
 {
     photosModel = new PhotosModel(outputDir);
     photosModel.RemovePhoto(removedPhoto);
     return(RedirectToAction("Photos", photosModel));
 }
Exemplo n.º 18
0
        //
        // GET: /Photos/

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

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