features/role-updates #18

Merged
jtom38 merged 8 commits from features/role-updates into main 2023-08-06 13:39:48 -07:00
1 changed files with 10 additions and 6 deletions
Showing only changes of commit 338edf8d4e - Show all commits

View File

@ -1,17 +1,13 @@
using System.Data;
using Dapper;
using Microsoft.Extensions.Configuration;
using Microsoft.EntityFrameworkCore;
using Newsbot.Collector.Domain.Entities;
using Newsbot.Collector.Domain.Interfaces;
using Newsbot.Collector.Domain.Models;
using Npgsql;
namespace Newsbot.Collector.Database.Repositories;
public class SourcesTable : ISourcesRepository
{
//private readonly string _connectionString;
private DatabaseContext _context;
private readonly DatabaseContext _context;
public SourcesTable(string connectionString)
{
@ -114,6 +110,14 @@ public class SourcesTable : ISourcesRepository
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)
{
//using var context = new DatabaseContext(_connectionString);