Exemplo n.º 1
0
        public ActionResult Index()
        {
            var model = new ContactModel();

            //activity log
            _studentActivityService.InsertActivity("Contact.Form", "ActivityLog.Contact.Form");

            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult SingleResponsibilityPrinciple()
        {
            //activity log
            _studentActivityService.InsertActivity("Course.Material.SingleResponsibilityPrinciple", "ActivityLog.Course.Material.SingleResponsibilityPrinciple");

            return(View());
        }
        public ActionResult Index(string id)
        {
            List <AchievementModel> model = new List <AchievementModel>();

            PrepareAchievementModel(model, _achievementService.GetAchievementList(), id);

            _studentActivityService.InsertActivity("Game.Achievements.List", "ActivityLog.Game.Achievements.List." + id);

            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult Index()
        {
            var model = new GameHomeModel();

            PrepareGameModel(model);

            //activity log
            _studentActivityService.InsertActivity("Home.Page.Game", "ActivityLog.Home.Page.Game");

            return(View(model));
        }
Exemplo n.º 5
0
        public ActionResult List()
        {
            var quizzes = _quizService.GetQuizList();
            var model   = new QuizListModel
            {
                QuizList = new List <QuizModel>()
            };

            foreach (var quiz in quizzes)
            {
                var quizModel = new QuizModel();
                PrepareQuizModel(quizModel, quiz);
                model.QuizList.Add(quizModel);
            }

            //activity log
            _studentActivityService.InsertActivity("Quiz.Student.List", "ActivityLog.Quiz.Student.List");

            return(View(model));
        }
        public ActionResult Index(string id)
        {
            var model = new List <LeaderboardModel>();

            IList <Leaderboard> leaderboard;

            if (id == "Main")
            {
                leaderboard      = _leaderboardService.GetMainLeaderboard();
                ViewBag.QuizName = "Main";
            }
            else
            {
                leaderboard      = _leaderboardService.GetLeaderboard(id);
                ViewBag.QuizName = _quizService.GetQuizBySystemName(id).Name;
            }

            PrepareLeaderboardModel(model, leaderboard);

            //activity log
            _studentActivityService.InsertActivity("Game.Leaderboard", "ActivityLog.Game.Leaderboard." + id);

            return(View(model));
        }
Exemplo n.º 7
0
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                var loginResult = _studentRegistrationService.ValidateStudent(model.Username, model.Password);
                switch (loginResult)
                {
                case StudentLoginResults.Successful:
                {
                    var student = _studentService.GetStudentByUsername(model.Username);

                    //sign in new student
                    _authenticationService.SignIn(student, model.RememberMe);

                    //activity log
                    _studentActivityService.InsertActivity("Game.Login", "ActivityLog.Game.Login", student);

                    if (String.IsNullOrEmpty(returnUrl) || !Url.IsLocalUrl(returnUrl))
                    {
                        return(RedirectToAction("Index", "Home"));
                    }

                    return(Redirect(returnUrl));
                }

                case StudentLoginResults.StudentNotExist:
                    ModelState.AddModelError("", "Student Does Not Exist");
                    break;

                case StudentLoginResults.Deleted:
                    ModelState.AddModelError("", "Deleted");
                    break;

                case StudentLoginResults.NotActive:
                    ModelState.AddModelError("", "NotActive");
                    break;

                case StudentLoginResults.NotRegistered:
                    ModelState.AddModelError("", "Not Registered");
                    break;

                default:
                    ModelState.AddModelError("", "Wrong Credentials");
                    break;
                }
            }

            //If we got this far, something failed, redisplay form
            return(View(model));
        }
Exemplo n.º 8
0
        public FileResult File(string id)
        {
            var currentFileName = (from fls in Files
                                   where fls.FileId == id
                                   select fls.FileUrl).First();

            if (String.IsNullOrEmpty(currentFileName))
            {
                return(null);
            }

            using (WebClient wc = new WebClient())
            {
                var byteArr = wc.DownloadData(currentFileName);

                //activity log
                _studentActivityService.InsertActivity("Course.Material.SampleCode", "ActivityLog.Course.Material.SampleCode." + id);

                return(File(byteArr, "application/x-zip-compressed"));
            }
        }