Exemplo n.º 1
0
        public JsonResult GetAnotherSeries(long parentId, long id)
        {
            if (WebSettingsConfig.Instance.IsSectionForbidden(SectionId.TVSeries) || IdValidator.IsInvalid(parentId) ||
                IdValidator.IsInvalid(id))
            {
                //TODO: на другой урл
                return(JsonResultHelper.Error());
            }

            var tvSeriesQuery = new TVSeriesQuery(WebSettingsConfig.Instance.DefaultUserLanguages.From.Id);
            List <TVSeriesWatch>             watches = tvSeriesQuery.GetSeriesWatches(parentId, id);
            IEnumerable <TVSeriesShortModel> result  = ConvertWatchesToModels(watches);

            return(JsonResultHelper.GetUnlimitedJsonResult(result));
        }
Exemplo n.º 2
0
        public void WriteTVSeries(XElement root)
        {
            var tvSeriesQuery          = new TVSeriesQuery(_languageId);
            List <TVSeriesInfo> covers = tvSeriesQuery.GetSeriesCovers();

            foreach (TVSeriesInfo tvSeriesInfo in covers)
            {
                string baseUrlPart = tvSeriesInfo.GetUrlPart();
                _sitemapItemWriter.WriteUrlToResult(root, UrlBuilder.GetTVSeriesUrl(baseUrlPart), 0.7m,
                                                    ChangeFrequency.WEEKLY);

                List <TVSeriesWatch> watches = tvSeriesQuery.GetSeriesWatches(tvSeriesInfo.GetId(),
                                                                              IdValidator.INVALID_ID);
                foreach (TVSeriesWatch tvSeriesWatch in watches)
                {
                    Tuple <string, string, string> pars = TVSeriesQuery.GetUrlParts(tvSeriesWatch.GetUrlPart());
                    string url = UrlBuilder.GetTVSeriesDetailUrl(pars.Item1, pars.Item2, pars.Item3);
                    _sitemapItemWriter.WriteUrlToResult(root, url, 0.6m, ChangeFrequency.MONTHLY);
                }
            }
        }
Exemplo n.º 3
0
        public ActionResult Detail(string baseUrlPart)
        {
            if (WebSettingsConfig.Instance.IsSectionForbidden(SectionId.TVSeries))
            {
                return(RedirectToAction("Index", RouteConfig.MAIN_CONTROLLER_NAME));
            }

            var tvSeriesQuery            = new TVSeriesQuery(WebSettingsConfig.Instance.DefaultUserLanguages.From.Id);
            List <TVSeriesWatch> watches = tvSeriesQuery.GetSeriesWatches(baseUrlPart);

            if (EnumerableValidator.IsEmpty(watches))
            {
                return(RedirectToAction("Index", RouteConfig.MAIN_CONTROLLER_NAME));
            }

            TVSeriesInfo seriesInfo = watches[0].GetSeriesInfo();
            var          model      = new TVSeriesModel {
                Title     = seriesInfo.Title,
                OrigTitle = seriesInfo.OrigTitle,
                Series    = ConvertWatchesToModels(watches)
            };

            return(View("../Video/TVSeriesIndex", model));
        }