private List <SelectListItem> BuildTimelineList() { // Get the account id int accountid = 0; if (Session["UserAccountID"] != null) { accountid = Convert.ToInt32(Session["UserAccountID"]); } // Build the timeline list List <SelectListItem> items = new List <SelectListItem>(); ITimelineRepository tlrep = new EntityTimelineRepository(); IEnumerable <Timeline> tls = tlrep.GetAllTimelines(accountid); foreach (Timeline tl in tls) { SelectListItem item = new SelectListItem(); item.Text = tl.TimelineName; item.Value = tl.TimelineID.ToString(); items.Add(item); } if (items.Count == 0) { SelectListItem item = new SelectListItem(); item.Text = "No media timelines available"; item.Value = "0"; items.Add(item); } return(items); }
private List <SelectListItem> BuildTimelineList(int currenttimelineid) { // Get the account id int accountid = 0; if (Session["UserAccountID"] != null) { accountid = Convert.ToInt32(Session["UserAccountID"]); } // Get the active timelines ITimelineRepository tlrep = new EntityTimelineRepository(); IEnumerable <Timeline> tls = tlrep.GetAllTimelines(accountid); List <SelectListItem> items = new List <SelectListItem>(); if (currenttimelineid > 0) { Timeline currenttimeline = tlrep.GetTimeline(currenttimelineid); SelectListItem item = new SelectListItem(); item.Text = currenttimeline.TimelineName; item.Value = currenttimeline.TimelineID.ToString(); items.Add(item); } foreach (Timeline tl in tls) { SelectListItem item = new SelectListItem(); item.Text = tl.TimelineName; item.Value = tl.TimelineID.ToString(); items.Add(item); } return(items); }