Example #1
0
        public IActionResult GetSeason(
            int year,
            ESeason season,
            [FromQuery] int page          = 1,
            [FromQuery][Max(25)] int size = 8,
            [FromQuery] bool includeMeta  = false
            )
        {
            var animesInPage = _animeService
                               .GetSeason(year, season)
                               .OrderBy(a => string.IsNullOrWhiteSpace(a.CoverImageUrl))
                               .ThenBy(a => a.Name)
                               .Page(page, size)
                               .ToList();

            var animePage = new ModelWithMetaVM <List <AnimeVM> >
            {
                Models = _mapper.Map <List <AnimeVM> >(animesInPage)
            };

            if (includeMeta)
            {
                animePage.Meta = new PaginationMetaVM
                {
                    BaseUrl     = Request.GetPath(),
                    Count       = _animeService.GetAnimesInSeason(year, season),
                    CurrentPage = page,
                    PageSize    = size,
                };
            }

            return(Ok(animePage));
        }
Example #2
0
        // constructor
        public VacationAction(int id, Mode mode) : base(id, mode)
        {
            _season = _mode.Calendar.Get();
            if (ESeason.MAX == _season)
            {
                Log.Error("invalid season");
                return;
            }

            _seasonId = (int)_season;
            _vacation = Manager.Instance.DT.Vacation[_seasonId];
        }
Example #3
0
        private static async Task <List <AnimeDataModel> > GetAnimes(int year, ESeason season)
        {
            var animeDataModels = new List <AnimeDataModel>();

            var url = string.Format(AnimeURL, KitsuAPI, year, season.ToString().ToLower(), MAX_PER_PAGE);

            while (!string.IsNullOrWhiteSpace(url))
            {
                var(next, rawAnimes) = await ProcessAnimePage(url);

                var filteredAnimes = rawAnimes.Where(c => c.Attributes.Subtype == "TV").ToList();
                animeDataModels.AddRange(filteredAnimes);

                url = next;
            }

            return(animeDataModels);
        }
Example #4
0
    private Sprite getVactionImage()
    {
        ESeason season = Manager.Instance.Object.NurtureMode.Calendar.Get();

        if (ESeason.MAX == season)
        {
            Log.Error("invalid season");
            return(null);
        }

        int      seasonId = (int)season;
        Vacation vacation = Manager.Instance.DT.Vacation[seasonId];

        if (Manager.Instance.Object.MainCharacter.IsChildHood())
        {
            return(vacation.childHood);
        }
        else
        {
            return(vacation.adultHood);
        }
    }
 public IEnumerable <Anime> GetSeason(int year, ESeason season) => _unitOfWork.Animes.GetSeason(year, season);
 public int GetAnimesInSeason(int year, ESeason season) => _unitOfWork.Animes.GetAnimesInSeason(year, season);
 public IQueryable <Anime> GetSeason(int year, ESeason season) => GetAll().Where(a => a.StartDate.Year == year && a.Season == season);
 public int GetAnimesInSeason(int year, ESeason season) => GetAll().Count(a => a.StartDate.Year == year && a.Season == season);