public List <VideoRepartoModel> CreaListaVideoRepartoModel() { VideoDS ds = new VideoDS(); List <VideoRepartoModel> model = new List <VideoRepartoModel>(); using (VideoBusiness bVideo = new VideoBusiness()) { bVideo.FillRW_VIDEO_REPARTI(ds); bVideo.FillRW_VIDEO(ds); List <RWListItem> Reparti_List = Reparti.CreaListaReparti(); var VideoRepartoAbilitati = ds.RW_VIDEO_REPARTI.Where(x => x.DATAFINE >= System.DateTime.Today && x.DATAINIZIO <= System.DateTime.Today).ToList(); foreach (var item in VideoRepartoAbilitati.OrderBy(x => x.DATAINIZIO)) { string NomeVideo = ds.RW_VIDEO.Where(x => x.IDVIDEO == item.IDVIDEO).Select(x => x.NOMEVIDEO).FirstOrDefault(); string NomeReparto = Reparti_List.Where(x => x.Value.Trim() == item.REPARTO).Select(x => x.Text).FirstOrDefault(); VideoRepartoModel vrm = new VideoRepartoModel(); vrm.Video = NomeVideo; vrm.Reparto = NomeReparto; vrm.IDVIDEOREPARTO = item.IDVIDEOREPARTO; vrm.DataInizio = item.DATAINIZIO; vrm.DataFine = item.DATAFINE; model.Add(vrm); } } return(model); }
public ActionResult CaricaAssociaVideoPartial() { VideoBLL bll = new VideoBLL(); List <RWListItem> Video_List = bll.CreaListaVideo(); List <RWListItem> Reparti_List = Reparti.CreaListaReparti(); ViewData.Add("video", Video_List); ViewData.Add("reparti", Reparti_List); return(PartialView("AssociaVideoRepartiPartial")); }