This commit is contained in:
2019-05-07 14:01:23 +01:00
parent 042c3c873a
commit d3e57ba2d1
26 changed files with 128 additions and 131 deletions

View File

@ -95,7 +95,7 @@ namespace Yavsc
if (userName != null)
{
using (var db = new ApplicationDbContext()) {
var cx = db.Connections.SingleOrDefault(c => c.ConnectionId == Context.ConnectionId);
var cx = db.ChatConnection.SingleOrDefault(c => c.ConnectionId == Context.ConnectionId);
if (cx != null)
{
if (stopCalled)
@ -179,7 +179,7 @@ namespace Yavsc
string senderId = (await _dbContext.ChatConnection.SingleAsync (c=>c.ConnectionId == Context.ConnectionId)).ApplicationUserId;
if (_dbContext.Banlist.Any(b=>b.TargetId == senderId)) return false;
if (_dbContext.Ban.Any(b=>b.TargetId == senderId)) return false;
var destChatUser = await _dbContext.ChatConnection.SingleAsync (c=>c.ConnectionId == destConnectionId);
if (_dbContext.BlackListed.Any(b=>b.OwnerId == destChatUser.ApplicationUserId && b.UserId == senderId)) return false;
@ -200,9 +200,9 @@ namespace Yavsc
public void Abort()
{
var cx = _dbContext .Connections.SingleOrDefault(c=>c.ConnectionId == Context.ConnectionId);
var cx = _dbContext .ChatConnection.SingleOrDefault(c=>c.ConnectionId == Context.ConnectionId);
if (cx!=null) {
_dbContext.Connections.Remove(cx);
_dbContext.ChatConnection.Remove(cx);
_dbContext.SaveChanges();
}
}