Added TotalByTypeAsync to see if we need to pull multiple pages
This commit is contained in:
parent
22e9638f88
commit
338edf8d4e
@ -1,17 +1,13 @@
|
|||||||
using System.Data;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Dapper;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Newsbot.Collector.Domain.Entities;
|
using Newsbot.Collector.Domain.Entities;
|
||||||
using Newsbot.Collector.Domain.Interfaces;
|
using Newsbot.Collector.Domain.Interfaces;
|
||||||
using Newsbot.Collector.Domain.Models;
|
|
||||||
using Npgsql;
|
|
||||||
|
|
||||||
namespace Newsbot.Collector.Database.Repositories;
|
namespace Newsbot.Collector.Database.Repositories;
|
||||||
|
|
||||||
public class SourcesTable : ISourcesRepository
|
public class SourcesTable : ISourcesRepository
|
||||||
{
|
{
|
||||||
//private readonly string _connectionString;
|
//private readonly string _connectionString;
|
||||||
private DatabaseContext _context;
|
private readonly DatabaseContext _context;
|
||||||
|
|
||||||
public SourcesTable(string connectionString)
|
public SourcesTable(string connectionString)
|
||||||
{
|
{
|
||||||
@ -114,6 +110,14 @@ public class SourcesTable : ISourcesRepository
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<int> TotalByTypeAsync(string type)
|
||||||
|
{
|
||||||
|
var res = await _context.Sources
|
||||||
|
.Where(f => f.Type == type )
|
||||||
|
.CountAsync();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
public int Disable(Guid id)
|
public int Disable(Guid id)
|
||||||
{
|
{
|
||||||
//using var context = new DatabaseContext(_connectionString);
|
//using var context = new DatabaseContext(_connectionString);
|
||||||
|
Loading…
Reference in New Issue
Block a user