// // GET: /Default1/Create public ActionResult InactiveInstructor(int id) { var ins = InsBO.GetInstructorByID(id); ins.IsActive = false; InsBO.UpdateExist(ins); return(RedirectToAction("Index")); }
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")); }
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")); }