public string SearchAlbums(string paramList) { JavaScriptSerializer jsonObj = new JavaScriptSerializer(); string[] parameters = paramList.Split(','); string language = ""; var musicDir = ""; if (parameters.Length > 0) { language = parameters[0]; } if (parameters.Length > 0) { musicDir = parameters[1]; } List<Album> albums = new List<Album>(); try { AlbumsSongsDAL albumSongsDAL = new AlbumsSongsDAL(); //albums.Add(new Album { AlbumId = (10 + musicDirID), AlbumName = language }); albums = albumSongsDAL.SearchAlbumsAndUpdateHits(language, musicDir); } catch (Exception) { } return (jsonObj.Serialize(albums)); // return Json(albums); }
// // GET: /Test/ public ActionResult Index() { string paramList1 = "Hindi,1"; string paramList = paramList1; JavaScriptSerializer jsonObj = new JavaScriptSerializer(); string[] parameters = paramList.Split(','); string language = "Tamil"; string musicDir = "A.R. Rehman"; if (parameters.Length > 0 && parameters[0].Length>0) { language = parameters[0]; } if (parameters.Length > 1 && parameters[1].Length > 0) { musicDir = parameters[1]; } List<Album> albums = new List<Album>(); try { AlbumsSongsDAL albumSongsDAL = new AlbumsSongsDAL(); //albums.Add(new Album { AlbumId = (10 + musicDirID), AlbumName = language }); albums = albumSongsDAL.SearchAlbumsAndUpdateHits(language, musicDir); } catch (Exception) { ModelState.AddModelError("Error: Could not update page-hit", ""); } return View(); }
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(); }