public ChannelPage(Channel channel) { InitializeComponent(); ViewModel = new ChannelPageViewModel(channel); ViewModel.SetView(this); BindingContext = ViewModel; ViewModel.PostConstruct(); }
public ActionResult AddProgram(ChannelProgram model) { DateTime start = model.StartTime; var id = Url.RequestContext.RouteData.Values["id"].ToString(); _channelProgramService.AddProgram(id, start); IEnumerable <ChannelProgram> channelPrograms = _channelProgramService.GetAll().OrderBy(x => x.StartTime); IEnumerable <VideoContent> videoContents = _contentService.GetAll(); ChannelPageViewModel channelPageViewModel = new ChannelPageViewModel { ChannelPrograms = channelPrograms, VideoContents = videoContents }; return(RedirectToAction("Index", channelPageViewModel)); }
// GET: Admin/Channel public ActionResult Index(string tag, DateTime?startDate) { IEnumerable <ChannelProgram> channelPrograms = _channelProgramService.GetAll().OrderBy(x => x.StartTime); IEnumerable <VideoContent> videoContents = _contentService.GetAll(); if (!string.IsNullOrEmpty(tag)) { videoContents = videoContents.Where(x => x.Tag.ToLower().Contains(tag.ToLower())); } if (startDate != null) { channelPrograms = channelPrograms.Where(x => x.StartTime.Date == startDate.Value.Date); } ChannelPageViewModel channelPageViewModel = new ChannelPageViewModel { ChannelPrograms = channelPrograms, VideoContents = videoContents }; return(View(channelPageViewModel)); }
public ChannelPage() { this.InitializeComponent(); vm = DataContext as ChannelPageViewModel; }