// GET: Series public ActionResult Index() { List <Series> series = null; using (program_phstudiosEntities ctx = new program_phstudiosEntities()) { series = ctx.Series.Where(s => !s.Legacy).ToList(); } return(View(series)); }
// GET: Project public ActionResult Index() { List <Project> projects = null; using (program_phstudiosEntities ctx = new program_phstudiosEntities()) { projects = ctx.Projects.ToList(); } return(View(projects)); }
public ActionResult LatestProjects() { List <LatestProject> latestProjects = null; using (program_phstudiosEntities ctx = new program_phstudiosEntities()) { latestProjects = ctx.LatestProjects.OrderByDescending(p => p.Created).ToList(); } return(View(latestProjects)); }
// GET: LatestVideos public ActionResult LatestVideos() { List <LatestVideo> latestVideos = null; using (program_phstudiosEntities ctx = new program_phstudiosEntities()) { latestVideos = ctx.LatestVideos.OrderByDescending(v => v.ReleaseDate).ThenByDescending(v => v.Order).ToList(); } return(View(latestVideos)); }
// Get: View public ActionResult View(int?id) { Project project = null; using (program_phstudiosEntities ctx = new program_phstudiosEntities()) { project = ctx.Projects.Where(p => p.ID == id).Include(p => p.ProjectFeatures.Select(pf => pf.Feature)).FirstOrDefault(); } if (project == null) { return(RedirectToAction("Index", "Project")); } return(base.View(project)); }
// GET: View public ActionResult View(int?id, int?videoID) { SeriesViewModel seriesViewModel = null; if (id != null && id > 0) { using (program_phstudiosEntities ctx = new program_phstudiosEntities()) { Series s = ctx.Series.FirstOrDefault(series => series.ID == id); if (s == null) { return(RedirectToAction("Index", "Series")); } List <Resource> seriesResources = (from sr in ctx.SeriesResources join r in ctx.Resources on sr.Resource_ID equals r.ID where sr.Series_ID == s.ID select r).ToList(); List <VideoDetailsModel> videos = ctx.Videos.Where(v => v.Series_ID == s.ID).Select(v => new VideoDetailsModel { Video = v }).ToList(); foreach (VideoDetailsModel videoDetails in videos) { videoDetails.Resources = ctx.VideoResources.Where(vr => vr.Video_ID == videoDetails.Video.ID).Select(vr => vr.Resource).ToList(); } seriesViewModel = new SeriesViewModel { Series = s, SeriesResources = seriesResources, VideoDetails = videos.OrderBy(v => v.Video.Order).ToList() }; } } else { return(RedirectToAction("Index", "Series")); } return(base.View(seriesViewModel)); }
// GET: Home public ActionResult Index() { LatestViewModel latestContent = null; using (program_phstudiosEntities ctx = new program_phstudiosEntities()) { List <LatestVideo> latestVideos = ctx.LatestVideos.OrderByDescending(v => v.ReleaseDate).ThenByDescending(v => v.Order).Take(6).ToList(); List <LatestProject> latestProjects = ctx.LatestProjects.OrderByDescending(p => p.Created).Take(3).ToList(); latestContent = new LatestViewModel { LatestVideos = latestVideos, LatestProjects = latestProjects }; } return(View(latestContent)); }