コード例 #1
0
        public ActionResult SignOrQuitCourse(int courseId, bool userIsOnCourse = false)
        {
            logManager.AddEventLog("CoursesController => SignOrQuitCourse ActionResult called(GET)", "ActionResult");
            string currentUserId = User.Identity.GetUserId();

            ViewBag.RegistrationResult = "";

            if (userIsOnCourse)
            {
                ViewBag.RegistrationResult = coursesManager.RemoveUserFromCourse(courseId, currentUserId);
                journalsManager.RemoveJournalForUser(currentUserId);
            }
            else
            {
                ViewBag.RegistrationResult = coursesManager.AddUserToCourse(courseId, currentUserId);
                journalsManager.AddJournalForUser(courseId, currentUserId);
            }

            return(View());
        }