コード例 #1
0
        //
        // GET: /Default1/Create


        public ActionResult InactiveInstructor(int id)
        {
            var ins = InsBO.GetInstructorByID(id);

            ins.IsActive = false;
            InsBO.UpdateExist(ins);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult CreateInstructorAccount(int InstructorID)
        {
            var instructor = InsBO.GetInstructorByID(InstructorID);

            if (instructor.User == null)
            {
                var user = AccBO.CreateUser(instructor.Fullname);
                user.RoleID     = 4;
                instructor.User = user;
                InsBO.UpdateExist(instructor);
            }
            return(RedirectToAction("InstructorAccountList", "Admin"));
        }
コード例 #3
0
        public ActionResult Authorize(String code)
        {
            var APIWrapper = new GoogleCalendarAPIWrapper();

            APIWrapper.RedirectUri = @"http://localhost:35728/Instructor/Authorize";
            String RefreshToken = APIWrapper.GetRefreshToken(code);

            //Tim instructor da dang nhạp vao
            string     Username             = this.HttpContext.User.Identity.Name;
            User       User                 = AccBO.GetUserByUsername(Username);
            Instructor AuthorizedInstructor = InsBO.GetInstructorByUserID(User.UserID);

            //Tu code, lay refresh token
            AuthorizedInstructor.ApiToken = RefreshToken;
            InsBO.UpdateExist(AuthorizedInstructor);

            TempData["Message"] = "Token received. Your calendar will be sync to Google Calendar later.";
            return(RedirectToAction("TeachingCalendar"));
        }