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