|
|
|
@ -0,0 +1,126 @@
|
|
|
|
|
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<Quote>
|
|
|
|
|
{
|
|
|
|
|
private WTFContext _context;
|
|
|
|
|
private GenericRepository<Quote> _repo;
|
|
|
|
|
|
|
|
|
|
public DbQuoteManager(WTFContext context)
|
|
|
|
|
{
|
|
|
|
|
_context = context ?? throw new ArgumentNullException(nameof(context), "Database context cannot be null.");
|
|
|
|
|
_repo = new GenericRepository<Quote>(_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<PaginationResult<Quote>> GetAllQuote()
|
|
|
|
|
{
|
|
|
|
|
List<Quote> quotes = _repo.GetItems(0, _repo.Count(), [nameof(Quote.Id)]).ToList();
|
|
|
|
|
return new PaginationResult<Quote>(quotes.Count, 0, quotes.Count, quotes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<PaginationResult<Quote>> GetAllQuoteLang(int index, int pageSize, int lang)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<Quote> GetDailyQuote(DateOnly date, int lang)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<PaginationResult<Quote>> GetFavorites(int index, int pageSize, int UserId)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<PaginationResult<Quote>> GetInvalidQuote(int index, int pageSize, int lang)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<PaginationResult<Quote>> GetInvalidQuote(int index, int pageSize)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<int> GetLastQuoteId()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<Quote> GetQuoteById(int id)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<PaginationResult<Quote>> GetSomeQuote(int index, int pageSize)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<PaginationResult<Quote>> GetSuggestions(int index, int pageSize, int lang)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<PaginationResult<Quote>> GetValidQuote(int index, int pageSize)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task RemoveQuote(int quoteId)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<PaginationResult<Quote>> SearchByCharacter(string character, int index, int pageSize, int lang)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<PaginationResult<Quote>> SearchByContent(string content, int index, int pageSize, int lang)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<PaginationResult<Quote>> 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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|