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")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Department.Add(Department); await _context.SaveChangesAsync(); return(RedirectToPage("./Departments")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Course.Add(Course); await _context.SaveChangesAsync(); return(RedirectToPage("./Courses")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Professor.Add(Professor); await _context.SaveChangesAsync(); return(RedirectToPage("./ProfessorUsers")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.AspNetRoles.Add(AspNetRoles); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
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")); }
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 })); }