public ActionResult AddPhotoToAlbum() { var model = new ViewAlbumPhoto(); model.Albums = albumrepo.GetAllAlbums().Select(x => AlbumModelMapper.ModelToEntity(x)).ToList(); model.Photos = photorepo.GetAllPhoto().Select(x => PhotoModelMapper.ModelToEntity(x)).ToList(); //var model = new ViewAlbumPhoto(); //model.Photos = GalleryController.photos; //model.Albums = AlbumController.albums; return(View(model)); }
//public static List<Photo> photos = new List<Photo>(); //// GET: Gallery //public GalleryController() //{ // if (!photos.Any()) // { // photos.Add(new Photo { PhotoID = Guid.NewGuid(), PhotoName = "Skimboard.jpg", PhotoComment = new List<Comments> { new Comments { CommentOnPicture = "Skimboarding on the ocean" } } }); // photos.Add(new Photo { PhotoID = Guid.NewGuid(), PhotoName = "SkimboardThree.jpg", PhotoComment = new List<Comments> { new Comments { CommentOnPicture = "Skimboarding of three" } } }); // photos.Add(new Photo { PhotoID = Guid.NewGuid(), PhotoName = "SunsetSurf.jpg", PhotoComment = new List<Comments> { new Comments { CommentOnPicture = "Surfing in the sunset" } } }); // photos.Add(new Photo { PhotoID = Guid.NewGuid(), PhotoName = "surf.jpg", PhotoComment = new List<Comments> { new Comments { CommentOnPicture = "Surfing on the ocean" } } }); // photos.Add(new Photo { PhotoID = Guid.NewGuid(), PhotoName = "Water.jpg", PhotoComment = new List<Comments> { new Comments { CommentOnPicture = "Fine ocean" } } }); // } //} public ActionResult Index() { return(View(photoRepo.GetAllPhoto().Select(x => PhotoModelMapper.ModelToEntity(x)).ToList())); }