Esempio n. 1
0
        public ActionResult Create(PhotoViewModel pvm, HttpPostedFileBase uploadDate)
        {
            PhotoServiceClient psc = new PhotoServiceClient();

            if (uploadDate != null)
            {
                //Image image = new Bitmap(uploadImage.InputStream);
                string fileName= System.Guid.NewGuid() + ".jpeg";

                //ExifReader exifdate = new ExifReader(image);

                pvm.Photo.AddDate = DateTime.Now.ToString();
                pvm.Photo.Image = "/UserImagesBD/" + fileName;
                //pvm.Photo.Model = exifdate.getExifModel();
                //pvm.Photo.CreateDate = exifdate.getExifCDate();

                int fileSizeInBytes = uploadDate.ContentLength;
                MemoryStream target = new MemoryStream();
                uploadDate.InputStream.CopyTo(target);
                byte[] uploadImage = target.ToArray();

                psc.upload(fileName, uploadImage);
            }

            psc.create(pvm.Photo);
            return RedirectToAction("Album");
        }
Esempio n. 2
0
 public ActionResult Edit(string id)
 {
     PhotoServiceClient psc = new PhotoServiceClient();
     PhotoViewModel pvm = new PhotoViewModel();
     pvm.Photo = psc.find(id);
     if (!pvm.Photo.UserName.Equals(User.Identity.Name))
         return View("NotFound");
     ViewBag.Photo = pvm.Photo;
     return View("Edit", pvm);
 }
Esempio n. 3
0
 public ActionResult Delete(string id)
 {
     PhotoServiceClient psc = new PhotoServiceClient();
     PhotoViewModel pvm = new PhotoViewModel();
     pvm.Photo = psc.find(id);
     if (!(User.Identity.Name).Equals(pvm.Photo.UserName))
         return View("NotFound");
     psc.delete(psc.find(id));
     return RedirectToAction("Album");
 }
Esempio n. 4
0
 public ActionResult Edit(PhotoViewModel pvm)
 {
     PhotoServiceClient psc = new PhotoServiceClient();
     psc.edit(pvm.Photo);
     return RedirectToAction("Album");
 }