Commit 83531da5 authored by Clint.Network's avatar Clint.Network

Implement some stuffs

parent 30505079
...@@ -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");
} }
......
...@@ -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">&times;</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">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment