// 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.Attach(Auto).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AutoExists(Auto.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// 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.Staff.Add(Staff); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(long?id) { if (id == null) { return(NotFound()); } Auto = await _context.Auto.FindAsync(id); if (Auto != null) { _context.Auto.Remove(Auto); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(long?id) { if (id == null) { return(NotFound()); } CarsStolen = await _context.CarsStolen.FindAsync(id); if (CarsStolen != null) { _context.CarsStolen.Remove(CarsStolen); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }