Ejemplo n.º 1
0
        public GameEditViewModel(GameShelfContext db)
        {
            GameWithPersonInfo = new GameWithPersonInfo();

            var playTimeQuery = db.Playtimes.OrderBy(pt => pt.ID);

            PlayTimeSelect = new SelectList(playTimeQuery, "ID", "PlayTimeCategory");

            var personQuery = db.People.OrderBy(p => p.LastName).ThenBy(p => p.FirstName);

            AllPersonsData = new List <AssignedPersonData>();
            foreach (Person person in personQuery)
            {
                AllPersonsData.Add(new AssignedPersonData
                {
                    PersonID = person.ID,
                    FullName = person.FullName
                });
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var game = await db.Games
                       .Include(g => g.PlayTime)
                       .Include(g => g.GamePersonRelationships)
                       .ThenInclude(gpr => gpr.Person)
                       .SingleOrDefaultAsync(m => m.ID == id);

            var gpi = new GameWithPersonInfo(game);

            if (gpi == null)
            {
                return(NotFound());
            }

            return(View(gpi));
        }
Ejemplo n.º 3
0
 public GameEditViewModel()
 {
     GameWithPersonInfo = new GameWithPersonInfo();
 }