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
83531da5
Commit
83531da5
authored
Dec 23, 2018
by
Clint.Network
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement some stuffs
parent
30505079
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
HomeController.cs
Stratis.Guru/Controllers/HomeController.cs
+8
-1
Lottery.cshtml
Stratis.Guru/Views/Home/Lottery.cshtml
+35
-0
No files found.
Stratis.Guru/Controllers/HomeController.cs
View file @
83531da5
...
@@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Localization;
...
@@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Localization;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Caching.Memory
;
using
Microsoft.Extensions.Caching.Memory
;
using
Microsoft.Extensions.Options
;
using
Microsoft.Extensions.Options
;
using
MongoDB.Bson
;
using
NBitcoin
;
using
NBitcoin
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Linq
;
using
Newtonsoft.Json.Linq
;
...
@@ -84,6 +85,7 @@ namespace Stratis.Guru.Controllers
...
@@ -84,6 +85,7 @@ namespace Stratis.Guru.Controllers
{
{
ViewBag
.
NextDraw
=
long
.
Parse
(
_memoryCache
.
Get
(
"NextDraw"
).
ToString
());
ViewBag
.
NextDraw
=
long
.
Parse
(
_memoryCache
.
Get
(
"NextDraw"
).
ToString
());
ViewBag
.
Jackpot
=
_memoryCache
.
Get
(
"Jackpot"
);
ViewBag
.
Jackpot
=
_memoryCache
.
Get
(
"Jackpot"
);
ViewBag
.
Players
=
_participation
.
GetPlayers
(
_draws
.
GetLastDraw
());
return
View
();
return
View
();
}
}
...
@@ -98,6 +100,8 @@ namespace Stratis.Guru.Controllers
...
@@ -98,6 +100,8 @@ namespace Stratis.Guru.Controllers
return
RedirectToAction
(
"Participate"
,
new
{
id
=
lastDraw
});
return
RedirectToAction
(
"Participate"
,
new
{
id
=
lastDraw
});
}
}
ViewBag
.
NextDraw
=
long
.
Parse
(
_memoryCache
.
Get
(
"NextDraw"
).
ToString
());
ViewBag
.
NextDraw
=
long
.
Parse
(
_memoryCache
.
Get
(
"NextDraw"
).
ToString
());
ViewBag
.
Jackpot
=
_memoryCache
.
Get
(
"Jackpot"
);
ViewBag
.
Players
=
_participation
.
GetPlayers
(
_draws
.
GetLastDraw
());
ViewBag
.
Participate
=
true
;
ViewBag
.
Participate
=
true
;
return
View
(
"Lottery"
);
return
View
(
"Lottery"
);
}
}
...
@@ -107,6 +111,8 @@ namespace Stratis.Guru.Controllers
...
@@ -107,6 +111,8 @@ namespace Stratis.Guru.Controllers
public
IActionResult
Participate
(
string
id
)
public
IActionResult
Participate
(
string
id
)
{
{
ViewBag
.
NextDraw
=
long
.
Parse
(
_memoryCache
.
Get
(
"NextDraw"
).
ToString
());
ViewBag
.
NextDraw
=
long
.
Parse
(
_memoryCache
.
Get
(
"NextDraw"
).
ToString
());
ViewBag
.
Jackpot
=
_memoryCache
.
Get
(
"Jackpot"
);
ViewBag
.
Players
=
_participation
.
GetPlayers
(
_draws
.
GetLastDraw
());
ViewBag
.
Participate
=
true
;
ViewBag
.
Participate
=
true
;
var
pubkey
=
ExtPubKey
.
Parse
(
_drawSettings
.
PublicKey
);
var
pubkey
=
ExtPubKey
.
Parse
(
_drawSettings
.
PublicKey
);
...
@@ -130,6 +136,7 @@ namespace Stratis.Guru.Controllers
...
@@ -130,6 +136,7 @@ namespace Stratis.Guru.Controllers
if
(
stratisAdressRequest
.
unconfirmedBalance
+
stratisAdressRequest
.
balance
>
0
)
if
(
stratisAdressRequest
.
unconfirmedBalance
+
stratisAdressRequest
.
balance
>
0
)
{
{
HttpContext
.
Session
.
SetString
(
"Deposited"
,
depositAddress
);
HttpContext
.
Session
.
SetString
(
"Deposited"
,
depositAddress
);
HttpContext
.
Session
.
SetString
(
"DepositedAmount"
,
((
double
)(
stratisAdressRequest
.
unconfirmedBalance
+
stratisAdressRequest
.
balance
)).
ToString
());
return
Json
(
true
);
return
Json
(
true
);
}
}
return
BadRequest
();
return
BadRequest
();
...
@@ -148,7 +155,7 @@ namespace Stratis.Guru.Controllers
...
@@ -148,7 +155,7 @@ namespace Stratis.Guru.Controllers
public
IActionResult
SaveParticipation
(
string
nickname
,
string
address
)
public
IActionResult
SaveParticipation
(
string
nickname
,
string
address
)
{
{
_settings
.
IncrementIterator
();
_settings
.
IncrementIterator
();
_participation
.
StoreParticipation
(
HttpContext
.
Session
.
GetString
(
"Ticket"
),
nickname
,
address
);
_participation
.
StoreParticipation
(
HttpContext
.
Session
.
GetString
(
"Ticket"
),
nickname
,
address
,
double
.
Parse
(
HttpContext
.
Session
.
GetString
(
"DepositedAmount"
))
);
return
RedirectToAction
(
"Lottery"
);
return
RedirectToAction
(
"Lottery"
);
}
}
...
...
Stratis.Guru/Views/Home/Lottery.cshtml
View file @
83531da5
...
@@ -79,6 +79,41 @@
...
@@ -79,6 +79,41 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="players-modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<form method="post" asp-controller="Home" asp-action="SaveParticipation" class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-user-circle"></i> Lottery Players</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body text-center py-4">
<table class="table">
<thead>
<tr>
<th scope="col">Nickname</th>
<th scope="col">Date</th>
<th scope="col">Montant</th>
</tr>
</thead>
<tbody>
@foreach(var player in ViewBag.Players)
{
<tr>
<td>@player.Nickname</td>
<td>@(player.CreationDate.AsDateTime.ToString("G"))</td>
<td>@player.Amount STRAT</td>
</tr>
}
</tbody>
</table>
</div>
</form>
</div>
</div>
</div>
<div class="shadow-inset"></div>
<div class="shadow-inset"></div>
<section class="welcome-area pb-4" id="welcome-1">
<section class="welcome-area pb-4" id="welcome-1">
<div class="header-token">
<div class="header-token">
...
...
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