示例#1
0
        public async Task <IActionResult> GetRegisterTeacher(string error = "", string info = "")
        {
            var courses = await _context.Courses // TODO Fetch from courses repo
                          .AsNoTracking()
                          .Select(c => new TeacherCourseAddDto
            {
                Id   = c.Id,
                Name = c.Name
            })
                          .ToListAsync();

            var courses1 = await _cRepo.GetCoursesBrief();

            ViewBag.Courses = courses1.Content;
            ViewBag.Error   = error;
            ViewBag.Info    = info;
            return(View("RegisterTeacher"));
        }
示例#2
0
        public async Task <IActionResult> Students()
        {
            var id = HttpContext.User.Claims
                     .FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value;
            var idGuid = Guid.Parse(id);

            var result = await _cRepo.GetCoursesBrief(idGuid);

            if (result.IsSuccess)
            {
                ViewBag.Courses    = result.Content;
                ViewBag.Action     = "Students";
                ViewBag.Controller = "Teachers";
                return(View("SelectCourse"));
            }

            return(RedirectToAction("Students"));
        }