Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
guru
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
guru
Commits
aa9811bd
Commit
aa9811bd
authored
Dec 23, 2018
by
Clint.Network
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Draw ID
parent
c4ede544
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
4 deletions
+14
-4
Draws.cs
Stratis.Guru/Models/Draws.cs
+6
-0
IDraws.cs
Stratis.Guru/Models/IDraws.cs
+2
-1
Participation.cs
Stratis.Guru/Models/Participation.cs
+1
-0
Participations.cs
Stratis.Guru/Models/Participations.cs
+5
-3
No files found.
Stratis.Guru/Models/Draws.cs
View file @
aa9811bd
using
System
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
MongoDB.Bson
;
using
MongoDB.Driver
;
...
...
@@ -17,6 +18,11 @@ namespace Stratis.Guru.Models
_databaseContext
=
databaseContext
;
}
public
string
GetLastDraw
()
{
return
_databaseContext
.
Draws
.
Find
(
x
=>
true
).
ToList
().
OrderByDescending
(
x
=>
x
.
DrawDate
).
FirstOrDefault
().
Id
.
ToString
();
}
public
async
Task
InitDrawAsync
(
long
nextDrawTimestamp
)
{
if
(!
_databaseContext
.
Draws
.
Find
(
x
=>
x
.
DrawDate
.
Equals
(
nextDrawTimestamp
)).
Any
())
...
...
Stratis.Guru/Models/IDraws.cs
View file @
aa9811bd
...
...
@@ -6,6 +6,7 @@ namespace Stratis.Guru.Models
{
public
interface
IDraws
{
Task
InitDrawAsync
(
long
nextDrawTimestamp
);
Task
InitDrawAsync
(
long
nextDrawTimestamp
);
string
GetLastDraw
();
}
}
\ No newline at end of file
Stratis.Guru/Models/Participation.cs
View file @
aa9811bd
...
...
@@ -11,5 +11,6 @@ namespace Stratis.Guru.Models
public
string
WithdrawAddress
{
get
;
set
;
}
public
BsonDateTime
CreationDate
{
get
;
set
;
}
public
string
Nickname
{
get
;
internal
set
;
}
public
string
Draw
{
get
;
internal
set
;
}
}
}
\ No newline at end of file
Stratis.Guru/Models/Participations.cs
View file @
aa9811bd
...
...
@@ -5,21 +5,23 @@ namespace Stratis.Guru.Models
public
class
Participations
:
IParticipation
{
private
DatabaseContext
_databaseContext
;
private
IDraws
_draws
;
public
Participations
(
DatabaseContext
databaseContext
)
public
Participations
(
DatabaseContext
databaseContext
,
IDraws
draws
)
{
_databaseContext
=
databaseContext
;
_draws
=
draws
;
}
public
void
StoreParticipation
(
string
ticket
,
string
nickname
,
string
address
)
{
//TODO: store lottery id
_databaseContext
.
Participations
.
InsertOne
(
new
Participation
{
CreationDate
=
DateTime
.
Now
,
Ticket
=
ticket
,
Nickname
=
nickname
,
WithdrawAddress
=
address
WithdrawAddress
=
address
,
Draw
=
_draws
.
GetLastDraw
()
});
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment