Exemplo n.º 1
0
        public async Task EnsureSeedDataAsync()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                // Add the User.
                var user = new TaskUser()
                {
                    UserName   = "******",
                    Email      = "*****@*****.**",
                    FirstQuest = DateTime.UtcNow
                };

                await _userManager.CreateAsync(user, "Metal242$");
            }

            if (!_context.Quests.Any())
            {
                // Add new Data
                var beerQuest = new Quest()
                {
                    Name     = "Beer Run",
                    DueBy    = DateTime.UtcNow,
                    Reward   = "Lost of Beer!",
                    Status   = "Incomplete",
                    UserName = "******"
                };

                _context.Quests.Add(beerQuest);

                var laundryQuest = new Quest()
                {
                    Name     = "Do Laundry",
                    DueBy    = DateTime.UtcNow,
                    Reward   = "Game Time!",
                    Status   = "Complete",
                    UserName = "******"
                };

                _context.Quests.Add(laundryQuest);

                _context.SaveChanges();
            }
        }
Exemplo n.º 2
0
        public async Task EnsureSeedDataAsync()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                // Add the User.
                var user = new TaskUser()
                {
                    UserName = "******",
                    Email = "*****@*****.**",
                    FirstQuest = DateTime.UtcNow
                };

                await _userManager.CreateAsync(user, "Metal242$");
            }

            if (!_context.Quests.Any())
            {
                // Add new Data
                var beerQuest = new Quest()
                {
                    Name = "Beer Run",
                    DueBy = DateTime.UtcNow,
                    Reward = "Lost of Beer!",
                    Status = "Incomplete",
                    UserName = "******"
                };

                _context.Quests.Add(beerQuest);

                var laundryQuest = new Quest()
                {
                    Name = "Do Laundry",
                    DueBy = DateTime.UtcNow,
                    Reward = "Game Time!",
                    Status = "Complete",
                    UserName = "******"
                };

                _context.Quests.Add(laundryQuest);

                _context.SaveChanges();
            }
        }