예제 #1
0
        public ActionResult <Result> Authenticate([FromBody] DownloadAuthenticationRequest request)
        {
            if (request.Password != _settings.DownloadPassword)
            {
                return(Result.Failure("Invalid Password"));
            }

            DownloadAuthenticationRequiredAttribute.SetAuthenticated(_session);

            return(Result.Successful);
        }
예제 #2
0
        public ActionResult <EpisodesForMonthResponse> EpisodesForMonth([FromRoute] EpisodesForMonthRequest request)
        {
            var beginningOfMonth = new DateTime(request.Year, request.Month, 1);
            var endOfMonth       = beginningOfMonth.AddMonths(1).AddDays(-1);

            return(new EpisodesForMonthResponse
            {
                ShowDownload = DownloadAuthenticationRequiredAttribute.HasAuthenticated(HttpContext.Session),
                EpisodesInMonth = _episodeStore.FindEpisodesAiring(beginningOfMonth, endOfMonth)
                                  .OrderBy(x => x.AirDate)
                                  .ThenBy(x => x.ShowId)
                                  .ThenBy(x => x.Season)
                                  .ThenBy(x => x.EpisodeInSeason)
                                  .ToList(),
            });
        }