public Task <Either <DomainError, IEnumerable <AnimeInfoWithImageStorage> > > GetBySeason(Season season, int year)
        {
            var partitionKey = IdHelpers.GenerateAnimePartitionKey(season, (ushort)year);
            var tableQuery   = new TableQuery <AnimeInfoWithImageStorage>().
                               Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partitionKey));

            return(TableUtils.TryExecuteSimpleQuery(() => _tableClient.ExecuteQuerySegmentedAsync(tableQuery, null)));
        }
Exemplo n.º 2
0
        private static BlobImageInfo CreateDomainInformation(ImageInfo imageInfo, Season season, int year)
        {
            var title     = imageInfo.Title ?? string.Empty;
            var partition = IdHelpers.GenerateAnimePartitionKey(season, (ushort)year);
            var id        = IdHelpers.GenerateAnimeId(season.ToString(), year.ToString(), title);
            var directory = $"{year.ToString()}/{season.Value}";

            var blobName = IdHelpers.CleanAndFormatAnimeTitle(title);

            return(new BlobImageInfo(partition, id, directory, blobName, imageInfo.Url ?? string.Empty));
        }
        internal static AnimeInfoStorage ProjectToStorageModel(AnimeInfo source)
        {
            var year = OptionUtils.UnpackOption <ushort>(source.SeasonInformation.Year.Value, 0);

            return(new AnimeInfoStorage
            {
                RowKey = OptionUtils.UnpackOption(source.Id.Value, string.Empty),
                PartitionKey = IdHelpers.GenerateAnimePartitionKey(source.SeasonInformation.Season, year),
                Season = source.SeasonInformation.Season.Value,
                Year = year,
                Synopsis = OptionUtils.UnpackOption(source.Synopsis.Value, string.Empty),
                FeedTitle = OptionUtils.UnpackOption(source.FeedTitle.Value, string.Empty),
                Date = MapDate(source.Date),
                Title = OptionUtils.UnpackOption(source.Title.Value, string.Empty),
                Completed = source.Completed
            });
        }