Exemple #1
0
        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"));
        }
Exemple #2
0
        // 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());
        }
Exemple #3
0
        // 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());
        }