public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(DepartmentDetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentDetailExists(DepartmentDetail.DDID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.DepartmentDetail.Add(DepartmentDetail); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } DeptDetailPopUp = await _context.DeptDetailPopUp.FindAsync(id); if (DeptDetailPopUp != null) { _context.DeptDetailPopUp.Remove(DeptDetailPopUp); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }