Commit f92d8edf authored by Clint.Network's avatar Clint.Network

Add GetPlayers() Method

parent 59a36644
using System.Collections.Generic;
namespace Stratis.Guru.Models namespace Stratis.Guru.Models
{ {
public interface IParticipation public interface IParticipation
{ {
void StoreParticipation(string ticket, string nickname, string address); void StoreParticipation(string ticket, string nickname, string address);
List<string> GetPlayers(string draw);
} }
} }
\ No newline at end of file
using System; using System;
using System.Collections.Generic;
using System.Linq;
using MongoDB.Driver;
namespace Stratis.Guru.Models namespace Stratis.Guru.Models
{ {
...@@ -13,6 +16,8 @@ namespace Stratis.Guru.Models ...@@ -13,6 +16,8 @@ namespace Stratis.Guru.Models
_draws = draws; _draws = draws;
} }
public List<string> GetPlayers(string draw) => _databaseContext.Participations.Find(x => x.Draw.Equals(draw)).ToList().Select(x => x.Nickname).Distinct().ToList();
public void StoreParticipation(string ticket, string nickname, string address) public void StoreParticipation(string ticket, string nickname, string address)
{ {
_databaseContext.Participations.InsertOne(new Participation _databaseContext.Participations.InsertOne(new Participation
......
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