using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Entity; using Shared; namespace Contextlib { public class DbQuoteManager : IQuoteService { private WTFContext _context; private GenericRepository _repo; public DbQuoteManager(WTFContext context) { _context = context ?? throw new ArgumentNullException(nameof(context), "Database context cannot be null."); _repo = new GenericRepository(_context); } public async Task AddQuote(Quote quote) { if (quote == null) { throw new ArgumentNullException(nameof(quote), "quote cannot be null."); } _repo.Insert(quote); await _context.SaveChangesAsync(); } public async Task> GetAllQuote() { List quotes = _repo.GetItems(0, _repo.Count(), [nameof(Quote.Id)]).ToList(); return new PaginationResult(quotes.Count, 0, quotes.Count, quotes); } public async Task> GetAllQuoteLang(int index, int pageSize, int lang) { throw new NotImplementedException(); } public async Task GetDailyQuote(DateOnly date, int lang) { throw new NotImplementedException(); } public async Task> GetFavorites(int index, int pageSize, int UserId) { throw new NotImplementedException(); } public async Task> GetInvalidQuote(int index, int pageSize, int lang) { throw new NotImplementedException(); } public async Task> GetInvalidQuote(int index, int pageSize) { throw new NotImplementedException(); } public async Task GetLastQuoteId() { throw new NotImplementedException(); } public async Task GetQuoteById(int id) { throw new NotImplementedException(); } public async Task> GetSomeQuote(int index, int pageSize) { throw new NotImplementedException(); } public async Task> GetSuggestions(int index, int pageSize, int lang) { throw new NotImplementedException(); } public async Task> GetValidQuote(int index, int pageSize) { throw new NotImplementedException(); } public async Task RemoveQuote(int quoteId) { throw new NotImplementedException(); } public async Task> SearchByCharacter(string character, int index, int pageSize, int lang) { throw new NotImplementedException(); } public async Task> SearchByContent(string content, int index, int pageSize, int lang) { throw new NotImplementedException(); } public async Task> SearchBySource(string source, int index, int pageSize, int lang) { throw new NotImplementedException(); } public async Task UpdateQuote(int quoteId, Quote quote) { throw new NotImplementedException(); } public async Task ValidateQuote(int quoteId, bool isValidate) { throw new NotImplementedException(); } } }