コード例 #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            AcademicRecord = await _context.AcademicRecord.FirstOrDefaultAsync(m => m.AcademicRecordID == id);

            if (AcademicRecord == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            AcademicRecord = await _context.AcademicRecord.FindAsync(id);

            if (AcademicRecord != null)
            {
                _context.AcademicRecord.Remove(AcademicRecord);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            NuvAdUser user = await GetCurrentUserAsync();

            var sturecord = from s in _context.Student select s;

            sturecord = sturecord.Where(ab => ab.userID.Equals(user.Id));

            AcademicRecord = _context.AcademicRecord.FirstOrDefault(m => m.AcademicRecordID == id && m.StudentID == sturecord.FirstOrDefault().StudentID);

            if (AcademicRecord == null)
            {
                return(NotFound());
            }
            return(Page());
        }