예제 #1
0
 public ActionResult SearchAlbumsSongsTest()
 {
     ViewBag.Message = "Search Albums/ Songs";
     AlbumsSongsDAL albumSongsDAL = new AlbumsSongsDAL();
     try
     {
         //List<string> testLanguageLi= st = albumSongsDAL.GetLanguageList();
         //List<string> testMDList = GetLanguageList();
         ViewBag.LanguageList = albumSongsDAL.GetLanguageList();
         ViewBag.MusicDirectorList = albumSongsDAL.GetMusicDirectorList();
         ViewBag.TopFiveAlbums = albumSongsDAL.GetTopFiveAlbums();
         ViewBag.TopFiveSongs = albumSongsDAL.GetTopFiveSongs();
         ViewBag.SearchAlbums = albumSongsDAL.SearchAlbumsAndUpdateHits("Hindi","A.R. Rahman");
         ViewBag.SearchSongs = albumSongsDAL.SearchSongsAndUpdateHits("Tamil","Illeya Raja");
     }
     catch (Exception)
     {
     }
     return View();
 }
        public string SearchSongs(string paramList)
        {
            JavaScriptSerializer jsonObj = new JavaScriptSerializer();
            string[] parameters = paramList.Split(',');
            string language = "";
            var musicDirector = "";
            if (parameters.Length > 0)
            {
                language = parameters[0];
            }
            if (parameters.Length > 0)
            {
                musicDirector = parameters[1];
            }
            List<Song> songs= new List<Song>();
            //List<Album> albums = new List<Album>();
            try
            {
                AlbumsSongsDAL albumSongsDAL = new AlbumsSongsDAL();
                //songs.Add(new Song { SongId=musicDirector});
                //albums.Add(new Album { AlbumId = (10 + musicDirID), AlbumName = language });
                songs = albumSongsDAL.SearchSongsAndUpdateHits(language, musicDirector);
            }
            catch (Exception)
            {

            }
            return (jsonObj.Serialize(songs));
        }