public ActionResult AddAlbum(AdminViewModel vm) { AddAlbum album = vm.AddAlbum; string[] tmp = album.Genres.Split(' '); Album a = new Album(); foreach (string s in tmp) { a.Genres.Add(s); } tmp = album.Tags.Split(' '); foreach (string s in tmp) { a.Tags.Add(s); } a.Picture = albumRepo.SaveImage(album.Picture, album.Name); a.Year = album.Year; a.AlbumName = album.Name; string artistref = album.ArtistId; var artist = new Artist(); artist = artistRepo.GetArtistById(artistref); a.ArtistName = artist.Id.ToString(); albumRepo.AddAlbum(a); artist.Albums.Add(a); artistRepo.UpdateArtist(artist); return(RedirectToAction("Index", "Admin")); }
//poziva pri otvaranju prozora AddBoss pri dodavanju novih albuma public AddAlbumViewModel(AddAlbum addAlbumOpen) { album = new vwAlbum(); addAlbum = addAlbumOpen; using (Service1Client wcf = new Service1Client()) { GenreList = wcf.GetAllGenre(null).ToList(); ArtistList = wcf.GetAllArtist(null).ToList(); } }
public ActionResult Index() { AddAlbum addA = new AddAlbum(); AddArtist AddAr = new AddArtist(); AddSong addS = new AddSong(); addA.ArtistIds = artistRepo.GetAllArtists().Select(artist => new SelectListItem() { Text = artist.ArtistName, Value = artist.Id.ToString() }).ToList(); addA.ArtistId = addA.ArtistIds.First().Value.ToString(); //addA.ArtistId = "1"; //addS.SelectedArtist = "1"; //addS.SelectedAlbum = "1"; addS.Artists = addA.ArtistIds; addS.SelectedArtist = addA.ArtistId; var alfa = albumRepo.GetAllAlbums(); addS.Albums = alfa.Select(album => new SelectListItem() { Text = album.AlbumName, Value = album.Id.ToString() }).ToList(); addS.SelectedAlbum = addS.Albums.First().Value.ToString(); var model = new AdminViewModel(); //{ // AddAlbum = new AddAlbum() // { // ArtistIds = artistRepo.GetAllArtists().Select(artist => new SelectListItem() { Text = artist.ArtistName, Value = artist.Id.ToString() }).ToList(), // ArtistId = artistRepo.GetAllArtists().First<Artist>().Id.ToString() // }, // AddArtist = new Models.AddArtist(), // AddSong = new AddSong() // { // Albums = albumRepo.GetAllAlbums().Select(al => new SelectListItem() { Text = al.AlbumName, Value = al.Id.ToString() }).ToList(), // Artists = artistRepo.GetAllArtists().Select(a => new SelectListItem() { Text = a.ArtistName, Value = a.Id.ToString() }).ToList(), // SelectedArtist = artistRepo.GetAllArtists().First<Artist>().Id.ToString(), // SelectedAlbum = albumRepo.GetAllAlbumsByOneArtist(artistRepo.GetAllArtists().First<Artist>().Id.ToString()).First().ToString() // } //}; model.AddArtist = AddAr; model.AddAlbum = addA; model.AddSong = addS; return(View(model)); }
public PhotoFrameApplication() { this.ServiceFactory = new ServiceFactory(); this.repositoryMaster = new RepositoryMaster(); this.photoFileService = ServiceFactory.PhotoFileService; this.searchFolder = new SearchFolder(repositoryMaster, photoFileService); this.filter = new Filter(repositoryMaster); this.addKeyword = new AddKeyword(repositoryMaster); this.deleteKeyword = new DeleteKeyword(repositoryMaster); this.toggleIsFavorite = new ToggleIsFavorite(repositoryMaster); this.addAlbum = new AddAlbum(repositoryMaster); this.searchAlbum = new SearchAlbum(repositoryMaster); this.sortDateAscending = new SortDateAscending(); this.sortDateDescending = new SortDateDescending(); this.getAllAlbums = new GetAllAlbums(repositoryMaster); }