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