コード例 #1
0
ファイル: JikanParser.cs プロジェクト: Akenaide/Seiyuu.moe
        private async Task UpdateAnime(Data.Model.Anime anime, JikanDotNet.Anime animeParsedData)
        {
            anime.Title         = animeParsedData.Title;
            anime.About         = animeParsedData.Synopsis;
            anime.EnglishTitle  = animeParsedData.TitleEnglish;
            anime.JapaneseTitle = animeParsedData.TitleJapanese;
            anime.Popularity    = animeParsedData.Members;

            anime.ImageUrl = EmptyStringIfPlaceholder(animeParsedData.ImageURL);

            if (animeParsedData.Aired.From.HasValue)
            {
                anime.AiringDate = animeParsedData.Aired.From.Value.ToString("dd-MM-yyyy");
            }

            if (animeParsedData.TitleSynonyms.Count > 0)
            {
                anime.TitleSynonyms = string.Join(';', animeParsedData.TitleSynonyms);
            }

            anime.TypeId = await MatchAnimeType(animeParsedData.Type);

            anime.StatusId = await MatchAnimeStatus(animeParsedData.Status);

            anime.SeasonId = string.IsNullOrEmpty(animeParsedData.Premiered) ?
                             await MatchSeason(animeParsedData.Aired.From) :
                             await MatchSeason(animeParsedData.Premiered);

            animeRepository.Update(anime);

            await animeRepository.CommitAsync();
        }