コード例 #1
0
        public ActionResult DeleteActivity(long Id)
        {
            ActivityData activity = rsContext.getActivity(Id);

            TempData["infoMessage"] = Resources.Resources.TheActivityHaveBeenDeletedSuccessfully + activity.ActivityName;
            rsContext.DeleteActivity(Id);
            return(RedirectToAction("ExistingActivities"));
        }
コード例 #2
0
        // GET: Student/ViewRoomOrWaitingScreen
        public ActionResult ViewRoomOrWaitingScreen(StudentLoginViewModel model)
        {
            RoomData     roomData     = rsContext.getRoom(model.Room);
            ActivityData activityData = rsContext.getActivity(roomData.CurrentActivityId);

            if (activityData == null)
            {
                //Waiting Screen
                return(RedirectToAction("Wait", model));
            }
            else
            {
                if (activityData is TrueFalseQuestionData)
                {
                    //True/False Question
                    TrueFalseQuestion tfq = (TrueFalseQuestion)Adapting.getTrueFalseQuestionFromData((TrueFalseQuestionData)activityData);
                    return(RedirectToAction("TrueFalseQuestion", new { expId = -1, currActivityIndex = -1, activityId = tfq.id, numOfActivities = 0, studentPhone = model.PhoneNumber, studentRoom = model.Room }));
                }
                else if (activityData is ShortAnswerQuestionData)
                {
                    //Short Answer Question
                    ShortAnswerQuestion saq = (ShortAnswerQuestion)Adapting.getShortAnswerQuestionFromData((ShortAnswerQuestionData)activityData);
                    return(RedirectToAction("ShortAnswerQuestion", new { expId = -1, currActivityIndex = -1, activityId = saq.id, numOfActivities = 0, studentPhone = model.PhoneNumber, studentRoom = model.Room }));
                }
                else if (activityData is AmericanQuestionData)
                {
                    //American Answer Question
                    AmericanQuestion aq = (AmericanQuestion)Adapting.getAmericanQuestionFromData((AmericanQuestionData)activityData);
                    return(RedirectToAction("AmericanQuestion", new { expId = -1, currActivityIndex = -1, activityId = aq.id, numOfActivities = 0, studentPhone = model.PhoneNumber, studentRoom = model.Room }));
                }

                else if (activityData is ExperimentData)
                {
                    // Experiment
                    Experiment exp = (Experiment)Adapting.getExperimentFromData((ExperimentData)activityData);
                    if (exp.ActiveExpID == 0)
                    {
                        //Waiting Screen
                        Thread.Sleep(2000);
                        return(RedirectToAction("Wait", model));
                    }
                    return(RedirectToAction("GroupCreation", new { expId = exp.id, studentPhone = model.PhoneNumber, studentRoom = model.Room, currActivityIndex = 0 }));
                }
            }

            return(View());
        }
コード例 #3
0
        public ActionResult ShowCurrentActivity()
        {
            TeacherData  teacherData  = rsContext.getTeacher(User.Identity.Name);
            RoomData     roomData     = rsContext.getRoom(teacherData.RoomId);
            ActivityData currActivity = rsContext.getActivity(roomData.CurrentActivityId);

            if (currActivity == null)
            {
                TempData["alertMessage"] = Resources.Resources.ThereIsNoActivityActivated;
                return(RedirectToAction("Dashboard"));
            }
            else
            {
                if (currActivity is TrueFalseQuestionData)
                {
                    return(View("DisplayTrueFalseQuestion", Adapting.getTrueFalseQuestionFromData((TrueFalseQuestionData)currActivity)));
                }
                else if (currActivity is ShortAnswerQuestionData)
                {
                    return(View("DisplayShortAnswerQuestion", Adapting.getShortAnswerQuestionFromData((ShortAnswerQuestionData)currActivity)));
                }
                else if (currActivity is AmericanQuestionData)
                {
                    return(View("DisplayAmericanQuestion", Adapting.getAmericanQuestionFromData((AmericanQuestionData)currActivity)));
                }
                else // experiment
                {
                    ExperimentData expData = (ExperimentData)currActivity;
                    if (expData.ActiveExpID == 0)
                    {
                        return(RedirectToAction("GroupSelection", new { ExpID = expData.id }));
                    }
                    else
                    {
                        ActiveExperimentData ae = rsContext.getActiveExperiment(expData.ActiveExpID);
                        return(StudentsProgress(Adapting.getActiveExperimentFromData(ae), true));
                    }
                }
            }
        }