public IEnumerable <ModelGallery> GetAllImages() { using (var ctx = new Labb1Context()) { return(ctx.image.ToList()); } }
public IEnumerable <Comments> GetAllComment() { using (var ctx = new Labb1Context()) { return(ctx.comment.ToList()); } }
public IEnumerable <AlbumModel> GetAllAlbums() { using (var ctx = new Labb1Context()) { return(ctx.album.Include("AlbumListOfImages").ToList()); } }
public IEnumerable <ModelGallery> GetAllImagesComment() { using (var ctx = new Labb1Context()) { return(ctx.image.Include("ImageComments").ToList()); } }
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); }
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(); } }
public void AddCommentToAlbum(Guid id, string albumComment) { using (var ctx = new Labb1Context()) { var addCommentToAlbum = new Comments() { CommentsAlbums = albumComment }; ctx.comment.Add(addCommentToAlbum); ctx.SaveChanges(); } }
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(); } }
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(); } }
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()); }
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); }
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(); } } }