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