コード例 #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(AspNetRoles).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AspNetRolesExists(AspNetRoles.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
コード例 #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Department.Add(Department);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Departments"));
        }
コード例 #3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Course.Add(Course);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Courses"));
        }
コード例 #4
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Professor.Add(Professor);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./ProfessorUsers"));
        }
コード例 #5
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.AspNetRoles.Add(AspNetRoles);
            await _context.SaveChangesAsync();

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

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

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

            return(RedirectToPage("./Index"));
        }
コード例 #7
0
        public async Task <IActionResult> OnPostAsync(string id, long sid, string cid)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            Student = await _context.Student.FirstOrDefaultAsync(s => s.UserId == id);

            var Enrollment = new Enrollment()
            {
                StudentId = sid,
                CourseId  = cid
            };

            _context.Enrollment.Add(Enrollment);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./CourseRegistration", new { id = Student.UserId }));
        }