Changed the default way to modify values in store. Added basic validation to stores. Using interfaces to DI store objects.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using HermesSocketLibrary.Requests.Messages;
|
||||
using HermesSocketServer.Models;
|
||||
using ILogger = Serilog.ILogger;
|
||||
|
||||
@@ -25,16 +26,16 @@ namespace HermesSocketServer.Requests
|
||||
return Task.FromResult(RequestResult.Failed("Order must be an integer."));
|
||||
bool state = data["state"].ToString()?.ToLower() == "true";
|
||||
|
||||
bool result = channel.Redemptions.Modify(id, r =>
|
||||
{
|
||||
if (r.UserId != channel.Id)
|
||||
return;
|
||||
Redemption redemption = new Redemption() {
|
||||
Id = id,
|
||||
UserId = channel.Id,
|
||||
RedemptionId = redemptionId,
|
||||
ActionName = actionName,
|
||||
Order = order,
|
||||
State = state,
|
||||
};
|
||||
|
||||
r.RedemptionId = redemptionId;
|
||||
r.ActionName = actionName;
|
||||
r.Order = order;
|
||||
r.State = state;
|
||||
});
|
||||
bool result = channel.Redemptions.Modify(id, redemption);
|
||||
|
||||
var r = channel.Redemptions.Get(id);
|
||||
if (result)
|
||||
|
||||
Reference in New Issue
Block a user