Ejemplo n.º 1
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();
            }
        }
Ejemplo n.º 2
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();
     }
 }
Ejemplo n.º 3
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();
     }
 }
Ejemplo n.º 4
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();
            }
        }
Ejemplo n.º 5
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());
        }
Ejemplo n.º 6
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();
                }
            }
        }