// 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.Trades.Add(Trade); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Trade = await _context.Trades.FindAsync(id); if (Trade != null) { _context.Trades.Remove(Trade); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }