コード例 #1
0
        public IActionResult LoadGameSelectionpage()
        {
            int memberId = (int)HttpContext.Session.GetInt32("memberId");


            MemberServices ms = new MemberServices();

            Member member = ms.GetMemberById(memberId);

            if (member is null)
            {
                throw new Exception("did not get member from database");
            }

            if (member.OwnedGames is null)
            {
                member.OwnedGames = new List <Game>();
            }
            if (member.LikeToPlayGames is null)
            {
                member.LikeToPlayGames = new List <Game>();
            }

            member.OwnedGames = ms.GetMemberOwnedGames(memberId);



            GameChooseViewModel vm = new GameChooseViewModel();

            vm.member = member;
            return(View("GameSelectionPage", vm));
        }