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