Exemplo n.º 1
0
        public async Task<PlayerList> GeneratePlayerListAsync(ApplicationDbContext db, ApplicationUser user)
        {
            if (user == null) return null;
            var result = new PlayerList();
            result.Active = true;
            result.ClubID = user.Club.ID;
            result.SetCreated(user);
            result.Name = Name;
            if (Players == null) Players = new List<JSONPlayer>();

            result.Players = await Players.GetPlayersAsync(db);
            if (File != null)
            {
                StreamReader reader = new StreamReader(File.InputStream, System.Text.Encoding.UTF8);
                var csvstring = await reader.ReadToEndAsync();
                var players = Utilities.ImportCSV(csvstring);
                foreach (var item in players)
                {
                    item.Club = user.Club;
                    result.Players.Add(item);
                }
            }

            return result;
        }
Exemplo n.º 2
0
 public JSONPlayerList(PlayerList model)
 {
     this.ID = model.ID;
     this.Players = model.Players != null? model.Players.ToList().GetJSON() : new List<JSONPlayer>();
     this.Name = model.Name;
     this.Deleted = model.Deleted;
 }