Пример #1
0
        public MyPage()
        {
            List <Personne> users = new List <Personne>()
            {
                new Personne("Hafida", "Elkorchi", 28),
                new Personne("calven", "Klein", 27),
                new Personne("Hugo", "Boss", 18),
            };
            MyPageVM vm = new MyPageVM();

            vm.Users = users;

            BindingContext = vm;
            InitializeComponent();
            //Adresse adresse1 = new Adresse("France", "Strasbourg");
            //Personne person = new Personne("Hafida", "Elkorchi", 28);
        }
        public IActionResult MyPage()
        {
            var userId = _userManager.GetUserId(HttpContext.User);

            MyPageVM myPageVM       = new MyPageVM();
            var      allMyQuizzes   = repository.Quizzes(userId);
            var      allMyQuizzesVM = new List <QuizToStartVM>();

            repository.CheckIfNewGameIsMoreThan24HoursOldAndDeleteIfTrue(allMyQuizzes);

            allMyQuizzes = repository.Quizzes(userId);

            foreach (var item in allMyQuizzes)
            {
                var r = item.NewGames.Count;
                allMyQuizzesVM.Add(new QuizToStartVM {
                    QuizId = item.QuizId, QuizName = item.QuizName, HasStartedNewGames = item.NewGames.Count > 0 ? true : false
                });
            }
            myPageVM.MyQuizzes = allMyQuizzesVM;
            return(View(myPageVM));
        }