public virtual async ValueTask <Tuple <ResponseStatus, object> > CountMangas(MangaQueryHelper query, long userId) { var mangaIds = query.QueryType switch { QueryType.Keyword => await MangaKeywordSearchService.Search(query.QueryString), QueryType.Favorite => await FavoriteMangaSearchService.Search(userId), QueryType.History => await MangaReadHistorySearchService.Search(userId), _ => throw new ArgumentOutOfRangeException() }; return(new Tuple <ResponseStatus, object>(ResponseStatus.Success, mangaIds.Count)); }
public virtual async ValueTask <Tuple <ResponseStatus, object> > ListMangas(MangaQueryHelper query, long userId) { var mangaIds = query.QueryType switch { QueryType.Keyword => await MangaKeywordSearchService.Search(query.QueryString), QueryType.Favorite => await FavoriteMangaSearchService.Search(userId), QueryType.History => await MangaReadHistorySearchService.Search(userId), _ => throw new ArgumentOutOfRangeException() }; var mangas = await MangaManager.GetMangas(mangaIds, query.Offset, query.Limit, query.OrderType, query.Asc); return(new Tuple <ResponseStatus, object>( mangas != null ? ResponseStatus.Success : ResponseStatus.NotFound, mangas)); }