public CourseRegTabbed()
        {
            InitializeComponent();
            string studentId = string.Empty;

            if (App.Current.Properties.ContainsKey("StudentId"))
            {
                studentId = App.Current.Properties["StudentId"] as string;
            }
            model          = new CourseRegViewModel(studentId);
            BindingContext = model;
        }
Beispiel #2
0
        public IActionResult OnGet(int deptId)
        {
            var     claimIdentity = (ClaimsIdentity)this.User.Identity;
            var     claim         = claimIdentity.FindFirst(ClaimTypes.NameIdentifier);
            Student studentInfo   = _studentRepo.GetFisrtOrDefault(s => s.ApplicationUserId == claim.Value);

            if (studentInfo != null)
            {
                CourseRegVM = new CourseRegViewModel
                {
                    AllCourses        = _courseRepo.GetAll(c => c.DeptId == deptId).ToList(),
                    RegisteredCourses = _courseRegRepo.GetAll(c => c.StudentId == studentInfo.Id).ToList(),
                    StudentInfo       = studentInfo
                };
                return(Page());
            }
            return(RedirectToPage("Registration"));
        }