Esempio n. 1
0
        public Gallery Connect()
        {
            //System.Console.WriteLine ("GalleryAccount.Connect()");

            Gallery gal = null;

            if (version == GalleryVersion.VersionUnknown)
            {
                this.version = Gallery.DetectGalleryVersion(Url);
            }

            if (version == GalleryVersion.Version1)
            {
                gal = new Gallery1(url, url);
            }
            else if (version == GalleryVersion.Version2)
            {
                gal = new Gallery2(url, url);
            }
            else
            {
                throw new Exception("Cannot connect to a Gallery for which the version is unknown");
            }

            System.Console.WriteLine("Gallery created: " + gal);

            gal.Login(username, password);

            gallery   = gal;
            connected = true;

            return(gallery);
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Gallery2 gallery2 = db.Gallery2.Find(id);

            db.Gallery2.Remove(gallery2);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "ID,Photo")] Gallery2 gallery2)
 {
     if (ModelState.IsValid)
     {
         db.Entry(gallery2).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(gallery2));
 }
Esempio n. 4
0
        // GET: SimitAdmin/AdminGallery2/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Gallery2 gallery2 = db.Gallery2.Find(id);

            if (gallery2 == null)
            {
                return(HttpNotFound());
            }
            return(View(gallery2));
        }
Esempio n. 5
0
        public ActionResult Create([Bind(Include = "ID,Photo")] Gallery2 gallery2, HttpPostedFileBase Photo)
        {
            if (ModelState.IsValid)
            {
                if (Photo != null)
                {
                    WebImage img      = new WebImage(Photo.InputStream);
                    FileInfo imgInfo  = new FileInfo(Photo.FileName);
                    string   FileName = Guid.NewGuid().ToString() + imgInfo.Extension;
                    img.Save("~/Public/uploads/Gallery/" + FileName);
                    gallery2.Photo = "/Public/uploads/Gallery/" + FileName;
                }
                db.Gallery2.Add(gallery2);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(gallery2));
        }
        public Gallery Connect()
        {
            //System.Console.WriteLine ("GalleryAccount.Connect()");
            Gallery gal = null;

            if (version == GalleryVersion.VersionUnknown)
            {
                this.version = Gallery.DetectGalleryVersion(Url);
            }

            if (version == GalleryVersion.Version1)
            {
                gal = new Gallery1(url, url);
            }
            else if (version == GalleryVersion.Version2)
            {
                gal = new Gallery2(url, url);
            }
            else
            {
                throw new GalleryException(Catalog.GetString("Cannot connect to a Gallery for which the version is unknown.\nPlease check that you have Remote plugin 1.0.8 or later"));
            }

            System.Console.WriteLine("Gallery created: " + gal);

            gal.Login(username, password);

            gallery   = gal;
            connected = true;

            object val = Preferences.Get(LIGHTTPD_WORKAROUND_KEY);

            if (val != null)
            {
                gallery.expect_continue = !(bool)val;
            }

            return(gallery);
        }