//display chores in table. view allows player to assign chores to others public IActionResult ViewChores() { string aspId = User.FindFirst(ClaimTypes.NameIdentifier).Value; ViewModelPlayerChore playerChore = new ViewModelPlayerChore(); //gets list of chores in Household playerChore.Chores = (_context.Chore.Where(x => x.ChoreStr1 == aspId).ToList()); //gets a list of players in the Household playerChore.Players = _context.Player.Where(x => x.PlayerStr1 == aspId).ToList(); return(View(playerChore)); }
public IActionResult SelectQuestion() { //find session player Helper helper = new Helper(_contextAccessor); var player = helper.PopulateFromSession(); var foundPlayer = _context.Player.Find(player.UserId); //setup ViewModel object, then sets relevant properties ViewModelPlayerChore myPlayerChore = new ViewModelPlayerChore(); myPlayerChore.LoggedInPlayer = foundPlayer; myPlayerChore.Chores = _context.Chore.Where(x => x.UserId == foundPlayer.UserId).ToList(); return(View(myPlayerChore)); }
//will become the new top-level link //this should not allow user to assign chores to other b/c it's a top-level view public IActionResult BuyChores() { Helper helper = new Helper(_contextAccessor); var player = helper.PopulateFromSession(); var foundPlayer = _context.Player.Find(player.UserId); string aspId = User.FindFirst(ClaimTypes.NameIdentifier).Value; ViewModelPlayerChore playerChore = new ViewModelPlayerChore(); playerChore.LoggedInPlayer = foundPlayer; //gets list of chores in Household playerChore.Chores = (_context.Chore.Where(x => x.ChoreStr1 == aspId).ToList()); //gets a list of players in the Household playerChore.Players = _context.Player.Where(x => x.PlayerStr1 == aspId).ToList(); return(View(playerChore)); }