Commit 2d7e3b56 authored by Clint.Network's avatar Clint.Network

Add Participation

parent 00d842fe
......@@ -23,5 +23,6 @@ namespace Stratis.Guru
public IMongoCollection<Draw> Draws => _database.GetCollection<Draw>("draws");
public IMongoCollection<Setting> Settings => _database.GetCollection<Setting>("lottery");
public IMongoCollection<Participation> Participations => _database.GetCollection<Participation>("participations");
}
}
\ No newline at end of file
namespace Stratis.Guru.Models
{
public interface IParticipation
{
void StoreParticipation(string ticket, string nickname, string address);
}
}
\ No newline at end of file
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace Stratis.Guru.Models
{
public class Participation
{
[BsonId]
public ObjectId Id { get; set; }
public string Ticket { get; set; }
public string WithdrawAddress { get; set; }
public BsonDateTime CreationDate { get; set; }
public string Nickname { get; internal set; }
}
}
\ No newline at end of file
using System;
namespace Stratis.Guru.Models
{
public class Participations : IParticipation
{
private DatabaseContext _databaseContext;
public Participations(DatabaseContext databaseContext)
{
_databaseContext = databaseContext;
}
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
});
}
}
}
\ No newline at end of file
......@@ -59,6 +59,7 @@ namespace Stratis.Guru
services.AddTransient<DatabaseContext>();
services.AddSingleton<ISettings, Models.Settings>();
services.AddSingleton<IDraws, Draws>();
services.AddSingleton<IParticipation, Participations>();
services.AddHostedService<UpdateInfosService>();
services.AddHostedService<FixerService>();
......
<h2 class="text-dark mb-1">Thank You</h2>
<p>We have received your $STRAT.</p>
<div class="form-group mt-3 required text-left">
<label for="withdrawAddress">Withdraw Address <span class="text-danger">*</span></label>
<input type="text" name="address" class="form-control text-dark form-control-lg" required id="withdrawAddress" placeholder="Enter a Stratis Address">
</div>
<div class="form-group required text-left">
<label for="nickname">Your Nickname <span class="text-danger">*</span></label>
<input type="text" name="nickname" class="form-control text-dark form-control-lg" required id="nickname" placeholder="Enter a Nickname">
</div>
<div class="form-group mb-0 required text-left">
<label for="ticket" class="required">Your Ticket Number</label>
<input type="text" class="form-control text-dark form-control-lg" id="ticket" value="@ViewBag.Ticket">
<small class="form-text text-muted">Please keep this ticket private.</small>
</div>
\ No newline at end of file
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