using DBConnection.Models; using DBConnection.Repositories.Interfaces; using Microsoft.EntityFrameworkCore; namespace DBConnection.Repositories; public class NovelRepository : BaseRepository, INovelRepository { public NovelRepository(AppDbContext dbContext) : base(dbContext) { } protected override IQueryable GetAllIncludedQueryable() { return DbContext.Novels .Include(i => i.Author) .Include(i => i.Chapters) .Include(i => i.Tags); } public async Task GetNovel(string url) { return await GetIncluded(i => i.Url == url); } public async Task> LookupNovelsByName(string name) { return await GetWhereIncluded(n => n.Title.Contains(name)); } public async Task> LookupNovelsByTag(string tag) { return await GetWhereIncluded(n => n.Tags.Any(nt => nt.TagValue.Contains(tag))); } }