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