Removed poll repository

This commit is contained in:
Kwoth
2021-06-18 08:34:03 +02:00
parent dbf51a8a1b
commit ae59bac118
7 changed files with 17 additions and 32 deletions

View File

@@ -3,6 +3,7 @@ using Discord;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Core.Services;
using System;
using System.Linq;
using System.Threading;
namespace NadekoBot.Modules.Games.Common
@@ -57,7 +58,7 @@ namespace NadekoBot.Modules.Games.Common
finally { _locker.Release(); }
using (var uow = _db.GetDbContext())
{
var trackedPoll = uow.Polls.GetById(Poll.Id);
var trackedPoll = uow._context.Poll.FirstOrDefault(x => x.Id == Poll.Id);
trackedPoll.Votes.Add(voteObj);
uow.SaveChanges();
}

View File

@@ -31,7 +31,7 @@ namespace NadekoBot.Modules.Games.Services
using (var uow = db.GetDbContext())
{
ActivePolls = uow.Polls.GetAllPolls()
ActivePolls = uow._context.Poll.GetAllPolls()
.ToDictionary(x => x.GuildId, x =>
{
var pr = new PollRunner(db, x);
@@ -70,7 +70,7 @@ namespace NadekoBot.Modules.Games.Services
{
using (var uow = _db.GetDbContext())
{
uow.Polls.Add(p);
uow._context.Poll.Add(p);
uow.SaveChanges();
}
@@ -87,7 +87,7 @@ namespace NadekoBot.Modules.Games.Services
pr.OnVoted -= Pr_OnVoted;
using var uow = _db.GetDbContext();
uow.Polls.RemovePoll(pr.Poll.Id);
uow._context.RemovePoll(pr.Poll.Id);
uow.SaveChanges();
return pr.Poll;