Ejemplo 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();
            }
        }
Ejemplo n.º 2
0
 public void DeleteQuest(Quest questToDelete)
 {
     _context.Remove(questToDelete);
 }
Ejemplo n.º 3
0
 public void AddQuest(Quest newQuest)
 {
     _context.Add(newQuest);
 }