Exemplo n.º 1
0
 public IEnumerable <ModelGallery> GetAllImages()
 {
     using (var ctx = new Labb1Context())
     {
         return(ctx.image.ToList());
     }
 }
Exemplo n.º 2
0
 public IEnumerable <Comments> GetAllComment()
 {
     using (var ctx = new Labb1Context())
     {
         return(ctx.comment.ToList());
     }
 }
Exemplo n.º 3
0
 public IEnumerable <AlbumModel> GetAllAlbums()
 {
     using (var ctx = new Labb1Context())
     {
         return(ctx.album.Include("AlbumListOfImages").ToList());
     }
 }
Exemplo n.º 4
0
 public IEnumerable <ModelGallery> GetAllImagesComment()
 {
     using (var ctx = new Labb1Context())
     {
         return(ctx.image.Include("ImageComments").ToList());
     }
 }
Exemplo n.º 5
0
        public ActionResult ImagesInAlbums(Guid AlbumID)
        {
            using (var ctx = new Labb1Context())
            {
                var album = Albumrepo.GetAllAlbums().First(x => x.AlbumID == AlbumID);

                return(View(album));
            }
            //var a = Albums.First(x => x.AlbumID == AlbumID);
        }
Exemplo n.º 6
0
        public void Delete(Guid id)
        {
            using (var ctx = new Labb1Context())
            {
                var images = ctx.image.Single(x => x.Id == id);

                ctx.image.Remove(images);

                ctx.SaveChanges();
            }
        }
Exemplo n.º 7
0
 public void AddCommentToAlbum(Guid id, string albumComment)
 {
     using (var ctx = new Labb1Context())
     {
         var addCommentToAlbum = new Comments()
         {
             CommentsAlbums = albumComment
         };
         ctx.comment.Add(addCommentToAlbum);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 8
0
 public void AddImageToAlbum(Guid imageID, Guid albumID)
 {
     using (var ctx = new Labb1Context())
     {
         var AddImagesToAlbum = new AlbumImages()
         {
             AlbumID = albumID,
             Id      = imageID
         };
         ctx.albumImage.Add(AddImagesToAlbum);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 9
0
        public void Add(ModelGallery image)
        {
            using (var ctx = new Labb1Context())
            {
                var newImage = new ModelGallery
                {
                    Id        = Guid.NewGuid(),
                    Name      = image.Name,
                    dateAdded = DateTime.Now
                };

                ctx.image.Add(newImage);

                ctx.SaveChanges();
            }
        }
Exemplo n.º 10
0
        public ActionResult CreateAlbum(AlbumModel album)
        {
            //album.AlbumID = Guid.NewGuid();
            //album.Date = DateTime.Now;
            //Albums.Add(album);
            //return Redirect("ListAlbums");

            using (var ctx = new Labb1Context())
            {
                album.AlbumID = Guid.NewGuid();
                ctx.album.Add(album);
                ctx.SaveChanges();
            }

            return(View());
        }
Exemplo n.º 11
0
        public ActionResult AddImageToAlbums()
        {
            using (var ctx = new Labb1Context())
            {
                var ListOfImages = ctx.image.ToList();
                var ListOfAlbum  = ctx.album.ToList();

                var imageToAlbum = new AlbumImages();
                imageToAlbum.Images = ListOfImages;
                imageToAlbum.Albums = ListOfAlbum;
                return(View(imageToAlbum));
            }
            //var imageToAlbum = new AlbumImages();
            //imageToAlbum.Images = HomeController.Images;
            //imageToAlbum.Albums = AlbumController.Albums;
            //return View(imageToAlbum);
        }
Exemplo n.º 12
0
        public void AddComment(ModelGallery image, string ImageComment)
        {
            using (var ctx = new Labb1Context())
            {
                var CommentImage = ctx.image.First(a => a.Id == image.Id);

                if (CommentImage != null)
                {
                    var MYCOMMENT = new Comments()
                    {
                        CommentsImages  = ImageComment,
                        ModelGallery_Id = CommentImage
                    };

                    ctx.comment.Add(MYCOMMENT);
                    ctx.SaveChanges();
                }
            }
        }