Exemplo n.º 1
0
        public ActionResult AddComment(Guid id, string photoComment)
        {
            var photo  = photorepo.AddCommentPhoto(id, photoComment);
            var photos = PhotoModelMapping.ModelToEntity(photo);

            return(PartialView("IndexPartial", photos));
        }
Exemplo n.º 2
0
        public ActionResult AddComment(Guid id)
        {
            var photo = photorepo.GetPhoto(id);
            var phot  = PhotoModelMapping.ModelToEntity(photo);

            return(PartialView("AddComment", phot));
        }
Exemplo n.º 3
0
        public ActionResult ShowPhoto(Guid id)
        {
            var showphotos = photorepo.GetPhoto(id);
            var showphot   = PhotoModelMapping.ModelToEntity(showphotos);

            return(PartialView(showphot));
        }
Exemplo n.º 4
0
 public ActionResult AddNewPhoto(string comment, HttpPostedFileBase[] files, Photo newphoto)
 {
     Thread.Sleep(3000);
     if (!ModelState.IsValid)
     {
         return(View(newphoto));
     }
     if (files == null)
     {
         ModelState.AddModelError("error", "No picture");
     }
     foreach (var file in files)
     {
         file.SaveAs(Path.Combine(Server.MapPath("/Image"), file.FileName));
         newphoto.PhotoID      = Guid.NewGuid();
         newphoto.PhotoName    = file.FileName;
         newphoto.PhotoComment = new List <Comments> {
             new Comments {
                 Id = Guid.NewGuid(), CommentOnPicture = comment
             }
         };
         var photos = PhotoModelMapping.EntityToModel(newphoto);
         photorepo.AddPhoto(photos);
     }
     return(PartialView("Index", photorepo.GetPhotos().Select(x => PhotoModelMapping.ModelToEntity(x)).ToList()));
 }
Exemplo n.º 5
0
        public ActionResult AddPhotoToAlbum()
        {
            var aModel = new AlbumPhotoView();

            aModel.Albums = albumrepo.GetAlbum().Select(x => AlbumModelMapping.ModelToEntity(x)).ToList();
            aModel.Photos = photorepo.GetPhotos().Select(x => PhotoModelMapping.ModelToEntity(x)).ToList();
            return(View(aModel));
        }
Exemplo n.º 6
0
        public ActionResult DeletePhoto(Guid id, Photo photo)
        {
            var    phot     = photorepo.GetPhoto(id);
            string fullpath = Request.MapPath("~/images/" + phot.PhotoName);

            if (System.IO.File.Exists(fullpath))
            {
                System.IO.File.Delete(fullpath);
                photorepo.DeletePhoto(phot);
            }

            return(RedirectToAction("Index", photorepo.GetPhotos().Select(x => PhotoModelMapping.ModelToEntity(x)).ToList()));
        }
Exemplo n.º 7
0
        // GET: Gallery


        public ActionResult Index()
        {
            return(View(photorepo.GetPhotos().Select(x => PhotoModelMapping.ModelToEntity(x)).ToList()));
        }