create Services folder and move Db.cs into it

This commit is contained in:
jetsparrow 2018-12-19 15:37:14 +03:00
parent faa46ac628
commit 7ea5b180cb

View File

@ -57,7 +57,7 @@ namespace JetKarmaBot
public byte GetAwardTypeId(string name) public byte GetAwardTypeId(string name)
=> AwardTypesByCommandName.GetOrDefault(name)?.AwardTypeId ?? DefaultAwardTypeId; => AwardTypesByCommandName.GetOrDefault(name)?.AwardTypeId ?? DefaultAwardTypeId;
public bool AddAward(byte awardTypeId, long fromId, long toId, long chatId) public bool AddAward(byte awardTypeId, long fromId, long toId, long chatId, int amount)
{ {
AddChat(new Chat() { ChatId = chatId }); AddChat(new Chat() { ChatId = chatId });
AddUser(new User() { UserId = fromId}); AddUser(new User() { UserId = fromId});
@ -67,8 +67,8 @@ namespace JetKarmaBot
@"INSERT INTO award @"INSERT INTO award
(chatid, fromid, toid, awardtypeid, amount) (chatid, fromid, toid, awardtypeid, amount)
VALUES VALUES
(@chatId, @fromId, @toId, @awardTypeId, 1)", (@chatId, @fromId, @toId, @awardTypeId, @amount)",
new { awardTypeId, fromId, toId, chatId }); new { awardTypeId, fromId, toId, chatId, amount });
return affected == 1; return affected == 1;
} }