public async Task <IActionResult> AddTeachers(IFormFileCollection ExcelFiles) { var jwt = Request.Cookies["Jwt"]; _uniAPI.SetJWT(jwt); if (jwt == null || String.IsNullOrWhiteSpace(jwt)) { await HttpContext.SignOutAsync("Cookies"); return(LocalRedirectPermanent("~/Home")); } await ExcelService.AddTeachers(ExcelFiles, _rootPath, _uniAPI); return(RedirectToAction("Index")); }
// GET: Login public async Task <ActionResult> Index() { var token = new Jwt() { Token = HttpContext.Request.Cookies["Jwt"] }; _uniAPI.SetJWT(token); if (User.Identity.IsAuthenticated) { return(LocalRedirectPermanent("~/Register/")); } return(View()); }
// GET: Register public async Task <ActionResult> Index() { var token = new Jwt() { Token = HttpContext.Request.Cookies["Jwt"] }; _uniAPI.SetJWT(token); ViewBag.Disciplines = new List <SelectListItem>(); ViewBag.Groups = new List <SelectListItem>(); ViewBag.Classes = new List <SelectListItem>(); var teacher_Id = User.Claims.Where(c => c.Type == "Id").Single().Value; var disciplinesResponse = await _uniAPI.Get <IEnumerable <Discipline> >($"disciplines/ByTeacher/{ teacher_Id }"); if (disciplinesResponse.Value != null) { ViewBag.Disciplines = disciplinesResponse.Value.Select(d => new SelectListItem(d.Name, d.Id.ToString())); } return(View()); }