private List <SelectListItem> BuildPlayListList() { // Get the account id int accountid = 0; if (Session["UserAccountID"] != null) { accountid = Convert.ToInt32(Session["UserAccountID"]); } // Build the play list list List <SelectListItem> items = new List <SelectListItem>(); // Create a blank item SelectListItem blank = new SelectListItem(); blank.Text = String.Empty; blank.Value = "0"; items.Add(blank); IPlayListRepository plrep = new EntityPlayListRepository(); IEnumerable <PlayList> pls = plrep.GetAllPlayLists(accountid); foreach (PlayList pl in pls) { SelectListItem item = new SelectListItem(); item.Text = pl.PlayListName; item.Value = pl.PlayListID.ToString(); items.Add(item); } return(items); }
private List <SelectListItem> BuildPlayListList(int currentplaylistid) { // Get the account id int accountid = 0; if (Session["UserAccountID"] != null) { accountid = Convert.ToInt32(Session["UserAccountID"]); } // Get the active play lists IPlayListRepository plrep = new EntityPlayListRepository(); IEnumerable <PlayList> pls = plrep.GetAllPlayLists(accountid); List <SelectListItem> items = new List <SelectListItem>(); if (currentplaylistid > 0) { PlayList currentplaylist = plrep.GetPlayList(currentplaylistid); SelectListItem item = new SelectListItem(); item.Text = currentplaylist.PlayListName; item.Value = currentplaylist.PlayListID.ToString(); items.Add(item); } foreach (PlayList pl in pls) { SelectListItem item = new SelectListItem(); item.Text = pl.PlayListName; item.Value = pl.PlayListID.ToString(); items.Add(item); } return(items); }
private List<SelectListItem> BuildPlayListList() { // Get the account id int accountid = 0; if (Session["UserAccountID"] != null) accountid = Convert.ToInt32(Session["UserAccountID"]); // Build the play list list List<SelectListItem> items = new List<SelectListItem>(); // Create a blank item SelectListItem blank = new SelectListItem(); blank.Text = String.Empty; blank.Value = "0"; items.Add(blank); IPlayListRepository plrep = new EntityPlayListRepository(); IEnumerable<PlayList> pls = plrep.GetAllPlayLists(accountid); foreach (PlayList pl in pls) { SelectListItem item = new SelectListItem(); item.Text = pl.PlayListName; item.Value = pl.PlayListID.ToString(); items.Add(item); } return items; }