Exemplo n.º 1
0
        public async Task Run(StepContext db)
        {
            if (!db.Team.Any())
            {
                var teams = new List <Team>
                {
                    new Team
                    {
                        TeamId   = 1,
                        TeamName = "Team_1",

                        /*
                         * Participants = new[]
                         * {
                         *
                         *  new Participant
                         *  {
                         *      ParticipantId = 1,
                         *      ParticipantName = "Alice",
                         *      IsAdmin = true,
                         *      IdentityUser = await GetIdentityUser("alice"),
                         *      Steps = GetSteps()
                         *  },
                         *  new Participant
                         *  {
                         *      ParticipantId = 2,
                         *      ParticipantName = "Bob",
                         *      IdentityUser = await GetIdentityUser("bob"),
                         *      Steps = GetSteps()
                         *  }
                         * }
                         */
                    },
                    new Team
                    {
                        TeamId   = 2,
                        TeamName = "Team_2",

                        /*
                         * Participants = new[]
                         * {
                         *  new Participant
                         *  {
                         *      ParticipantId = 3,
                         *      ParticipantName = "Susan",
                         *      IdentityUser = await GetIdentityUser("susan"),
                         *      Steps = GetSteps()
                         *  },
                         *  new Participant
                         *  {
                         *      ParticipantId = 4,
                         *      ParticipantName = "Helga",
                         *      IdentityUser = await GetIdentityUser("helga"),
                         *      Steps = GetSteps()
                         *  }
                         * }
                         */
                    }
                };

                teams.AddRange(GetTeams());
                db.Team.AddRange(teams);
                db.SaveChanges();
            }
        }