public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } CarSheet = await _context.CarSheet.FirstOrDefaultAsync(m => m.ID == id); if (CarSheet == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } CarSheet = await _context.CarSheet.FindAsync(id); if (CarSheet != null) { _context.CarSheet.Remove(CarSheet); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } CarSheet = await _context.CarSheet.FirstOrDefaultAsync(m => m.ID == id); if (CarSheet == null) { return(NotFound()); } ViewData["CarModelId"] = new SelectList(_context.Set <CarModel>(), "ID", "carModelName"); ViewData["CustomerId"] = new SelectList(_context.Set <Customer>(), "ID", "CustomerName"); return(Page()); }