Exemple #1
0
        public async Task <StreamFileUploadDatabase> GetSectionEpisodes(Guid id, Guid sub, string category, string section)
        {
            var model = await _context.ClamSectionAcademicSubCategoryItems.AsNoTracking().ToListAsync();

            List <SectionItem> result = new List <SectionItem>();

            foreach (var item in model)
            {
                if (item.SubCategoryId == sub && item.AcademicId == id)
                {
                    result.Add(new SectionItem()
                    {
                        ItemId          = item.ItemId,
                        ItemTitle       = FilePathUrlHelper.GetFileName(item.ItemTitle),
                        ItemPath        = item.ItemPath,
                        ItemDescription = item.ItemDescription,
                        LastModified    = item.LastModified,
                        DateAdded       = item.DateAdded,
                        Size            = item.Size,
                        UrlCategory     = category,
                        UrlSection      = section,
                        UrlSectionItem  = FilePathUrlHelper.UrlString(FilePathUrlHelper.GetFileName(item.ItemTitle))
                    });
                }
            }
            StreamFileUploadDatabase episodes = new StreamFileUploadDatabase()
            {
                SectionItems = result
            };

            episodes.AcademicId    = id;
            episodes.SubCategoryId = sub;
            return(episodes);
        }
Exemple #2
0
        public async Task <IActionResult> Video(Guid id, Guid show, Guid season, Guid data, string category, string section, string subsection, string subsectionitem)
        {
            var status = false;

            ViewBag.Gid = id;
            ViewBag.Sid = show;
            ViewBag.Sig = season;
            ViewBag.Vid = data;

            var seasonSelect = await _unitOfWork.TVShowControl.GetSeason(season);

            var showSelect = await _unitOfWork.TVShowControl.GetTVShow(show);

            var genreSelect = await _unitOfWork.TVShowControl.GetGenre(id);

            var episodeSelect = await _unitOfWork.TVShowControl.GetEpisode(data);

            ViewBag.Video      = FilePathUrlHelper.GetFileName(episodeSelect.ItemTitle);
            ViewBag.SeasonName = seasonSelect.TVShowSeasonNumber;
            ViewBag.ShowName   = showSelect.TVShowTitle;
            ViewBag.GenreName  = genreSelect.Genre;

            ViewBag.UrlGenre          = FilePathUrlHelper.UrlString(genreSelect.Genre);
            ViewBag.UrlSection        = FilePathUrlHelper.UrlString(showSelect.TVShowTitle);
            ViewBag.UrlSubsection     = seasonSelect.TVShowSeasonNumber.ToString();
            ViewBag.UrlSubsectionItem = FilePathUrlHelper.GetFileName(FilePathUrlHelper.UrlString(episodeSelect.ItemTitle));

            List <SelectListItem> episodes = new List <SelectListItem>();
            var model = await _unitOfWork.TVShowControl.GetSeasonEpisodes(id, show, season);

            foreach (var item in model.Episodes)
            {
                if (item.CategoryId == id && item.TVShowId == show && item.SeasonId == season && item.ItemId == data)
                {
                    status = true;
                    episodes.Add(new SelectListItem()
                    {
                        Text = item.ItemTitle, Value = item.ItemPath,
                    });
                }
            }
            if (status == true)
            {
                var result = await _unitOfWork.TVShowControl.GetEpisode(data);

                //ViewBag.Title = GetFileName(result.ItemPath);
                ViewBag.Title    = result.ItemTitle;
                ViewBag.Episodes = episodes;
                ViewBag.Path     = FilePathUrlHelper.DataFilePathFilter(result.ItemPath, 3);
                return(View(result));
            }
            return(RedirectToAction(nameof(Episode), new { Id = id, Show = show, Season = season }));
        }
Exemple #3
0
        public async Task <StreamTVShowFileUploadDatabase> GetSeasonEpisodes(Guid id, Guid show, Guid season)
        {
            var seasonSelect = await _context.ClamSectionTVShowSubCategorySeasons.FindAsync(season);

            var showSelect = await _context.ClamSectionTVShowSubCategories.FindAsync(show);

            var genreSelect = await _context.ClamSectionTVShowCategories.FindAsync(id);

            var model = await _context.ClamSectionTVShowSubCategorySeasonItems.AsNoTracking().ToListAsync();

            List <SectionTVShowSubCategorySeasonItem> result = new List <SectionTVShowSubCategorySeasonItem>();

            foreach (var item in model)
            {
                if (item.CategoryId == id && item.TVShowId == show && item.SeasonId == season)
                {
                    result.Add(new SectionTVShowSubCategorySeasonItem()
                    {
                        ItemId            = item.ItemId,
                        ItemPath          = item.ItemPath,
                        ItemTitle         = FilePathUrlHelper.GetFileName(item.ItemTitle),
                        Size              = item.Size,
                        LastModified      = item.LastModified,
                        DateCreated       = item.DateCreated,
                        CategoryId        = item.CategoryId,
                        TVShowId          = item.TVShowId,
                        SeasonId          = item.SeasonId,
                        UrlCategory       = FilePathUrlHelper.UrlString(genreSelect.Genre),
                        UrlSection        = FilePathUrlHelper.UrlString(showSelect.TVShowTitle),
                        UrlSubSection     = seasonSelect.TVShowSeasonNumber.ToString(),
                        UrlSubSectionItem = FilePathUrlHelper.UrlString(FilePathUrlHelper.GetFileName(item.ItemTitle))
                    });
                }
            }
            StreamTVShowFileUploadDatabase episodes = new StreamTVShowFileUploadDatabase()
            {
                Episodes = result
            };

            return(episodes);
        }
Exemple #4
0
        public async Task <IActionResult> Video(Guid id, Guid said, Guid data, string category, string section, string sectionitem)
        {
            var status = false;

            ViewBag.Data           = data;
            ViewBag.Said           = said;
            ViewBag.Aid            = id;
            ViewBag.UrlCategory    = FilePathUrlHelper.UrlString(category);
            ViewBag.UrlSection     = FilePathUrlHelper.UrlString(section);
            ViewBag.UrlSectionItem = FilePathUrlHelper.UrlString(sectionitem);

            List <SelectListItem> episdoes = new List <SelectListItem>();
            var model = await _unitOfWork.AcademiaControl.GetAllEpisodes();

            foreach (var item in model)
            {
                if (item.AcademicId == id && item.SubCategoryId == said && item.ItemId == data)
                {
                    status = true;
                }
                if (item.SubCategoryId == said)
                {
                    episdoes.Add(new SelectListItem()
                    {
                        Text = FilePathUrlHelper.GetFileName(item.ItemTitle), Value = item.ItemPath
                    });
                }
            }
            if (status == true)
            {
                var result = await _unitOfWork.AcademiaControl.GetVideo(data);

                ViewBag.Title    = FilePathUrlHelper.GetFileName(result.ItemTitle);
                ViewBag.Episodes = episdoes;
                ViewBag.Path     = FilePathUrlHelper.DataFilePathFilter(result.ItemPath, 3);
                return(View(result));
            }
            return(RedirectToAction(nameof(Episode), new { Id = id, Said = said, Category = category, Section = section }));
        }
        public void GetFileName_RemoveExtensionFromStoredTableTitle_ReturnsEqual()
        {
            // Arrange
            List <string> testFileNames = new List <string>()
            {
                "hello.txt",
                "world.txt",
                "program.ext",
                "software.exe",
                "picture.png",
                "image.jpg"
            };

            List <string> expectedResult = new List <string>()
            {
                "hello",
                "world",
                "program",
                "software",
                "picture",
                "image"
            };

            List <string> listResult = new List <string>();

            // Act
            foreach (var fileName in testFileNames)
            {
                listResult.Add(FilePathUrlHelper.GetFileName(fileName));
            }


            // Assert
            for (int i = 0; i < testFileNames.Count; i++)
            {
                Assert.AreEqual(expectedResult[i], listResult[i]);
            }
        }
Exemple #6
0
        public async Task <ClamflixTVShow> GetHomeDisplayTVShows(Guid id)
        {
            // use id parameter and retrieve SubCategory from TVShowSection
            var model = await _context.ClamSectionTVShowSubCategories.FindAsync(id);

            // Client Model Display
            ClamflixTVShow clientDisplay          = new ClamflixTVShow();
            var            showCategoriesSections = await _context.ClamSectionTVShowSubCategories.ToListAsync();

            var showCategoriesSeasons = await _context.ClamSectionTVShowSubCategorySeasons.ToListAsync();

            var showCategoriesSeasonItems = await _context.ClamSectionTVShowSubCategorySeasonItems.ToListAsync();

            clientDisplay.TVShowDisplay = _mapper.Map <SectionTVShowSubCategory>(model);

            // Client Display, collect seasons and suggested shows for recommendation to client
            foreach (var show in showCategoriesSections)
            {
                if ((show.TVShowId.Equals(model.TVShowId) && (show.CategoryId.Equals(model.CategoryId))))
                {
                    foreach (var season in showCategoriesSeasons)
                    {
                        if ((season.CategoryId.Equals(show.CategoryId)) && (season.TVShowId.Equals(show.TVShowId)))
                        {
                            List <SectionTVShowSubCategorySeasonItem> seasonEpisodes = new List <SectionTVShowSubCategorySeasonItem>();
                            foreach (var episode in showCategoriesSeasonItems)
                            {
                                if ((episode.TVShowId.Equals(show.TVShowId)) && (episode.SeasonId.Equals(season.SeasonId)))
                                {
                                    seasonEpisodes.Add(new SectionTVShowSubCategorySeasonItem()
                                    {
                                        CategoryId = episode.CategoryId,
                                        TVShowId   = episode.TVShowId,
                                        SeasonId   = episode.SeasonId,
                                        ItemId     = episode.ItemId,
                                        ItemTitle  = FilePathUrlHelper.GetFileName(episode.ItemTitle),
                                        ItemPath   = FilePathUrlHelper.DataFilePathFilter(episode.ItemPath, 3)
                                    });
                                }
                            }
                            clientDisplay.TVShowSeasons.Add(new SectionTVShowSubCategorySeason()
                            {
                                CategoryId                 = season.CategoryId,
                                TVShowId                   = season.TVShowId,
                                SeasonId                   = season.SeasonId,
                                TVShowSeasonNumber         = season.TVShowSeasonNumber,
                                ItemPath                   = FilePathUrlHelper.DataFilePathFilter(season.ItemPath, 3),
                                SubCategorySeasonItemCount = seasonEpisodes.Count,
                                SubCategorySeasonItemList  = seasonEpisodes
                            });
                        }
                    }
                }
                if ((show.CategoryId.Equals(model.CategoryId)) && (show.TVShowId != model.TVShowId))
                {
                    List <SectionTVShowSubCategorySeason> seasonsList = new List <SectionTVShowSubCategorySeason>();
                    foreach (var season in showCategoriesSeasons)
                    {
                        if ((season.TVShowId != show.TVShowId) && (season.CategoryId != show.CategoryId))
                        {
                            List <SectionTVShowSubCategorySeasonItem> seasonEpisodes = new List <SectionTVShowSubCategorySeasonItem>();
                            foreach (var episode in showCategoriesSeasonItems)
                            {
                                if ((episode.TVShowId != show.TVShowId) && (episode.SeasonId != season.SeasonId))
                                {
                                    seasonEpisodes.Add(new SectionTVShowSubCategorySeasonItem()
                                    {
                                        CategoryId = episode.CategoryId,
                                        TVShowId   = episode.TVShowId,
                                        SeasonId   = episode.SeasonId,
                                        ItemId     = episode.ItemId,
                                        ItemTitle  = FilePathUrlHelper.GetFileName(episode.ItemTitle),
                                        ItemPath   = FilePathUrlHelper.DataFilePathFilter(episode.ItemPath, 3)
                                    });
                                }
                            }
                            seasonsList.Add(new SectionTVShowSubCategorySeason()
                            {
                                CategoryId                 = season.CategoryId,
                                TVShowId                   = season.TVShowId,
                                SeasonId                   = season.SeasonId,
                                TVShowSeasonNumber         = season.TVShowSeasonNumber,
                                ItemPath                   = FilePathUrlHelper.DataFilePathFilter(season.ItemPath, 3),
                                SubCategorySeasonItemCount = seasonEpisodes.Count,
                                SubCategorySeasonItemList  = seasonEpisodes
                            });
                        }
                    }
                    clientDisplay.CategoryTVShows.Add(new SectionTVShowSubCategory()
                    {
                        CategoryId              = show.CategoryId,
                        TVShowId                = show.TVShowId,
                        TVShowTitle             = show.TVShowTitle,
                        ItemPath                = FilePathUrlHelper.DataFilePathFilter(show.ItemPath, 3),
                        TVShowSeasonNumberTotal = seasonsList.Count,
                        SubCategorySeasonList   = seasonsList
                    });
                }
            }
            ;

            return(clientDisplay);
        }