// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Course).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(Course.CourseId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Grade.Add(Grade); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Course = await _context.Course.FindAsync(id); if (Course != null) { _context.Course.Remove(Course); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Student = await _context.Student.FindAsync(id); if (Student != null) { _context.Student.Remove(Student); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task<IActionResult> OnPostAsync(int? id) { if (id == null) { return NotFound(); } Teacher = await _context.Teacher.FindAsync(id); if (Teacher != null) { _context.Teacher.Remove(Teacher); await _context.SaveChangesAsync(); } return RedirectToPage("./Index"); }