public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } CMCAssign = await _context.CMCAssign.FindAsync(id); if (CMCAssign != null) { _context.CMCAssign.Remove(CMCAssign); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } CMCAssign = await _context.CMCAssign .Include(c => c.Charger) .Include(c => c.Customer) .Include(c => c.Meter).FirstOrDefaultAsync(m => m.ChargerID == id); if (CMCAssign == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } CMCAssign = await _context.CMCAssign .Include(c => c.Charger) .Include(c => c.Customer) .Include(c => c.Meter).FirstOrDefaultAsync(m => m.ChargerID == id); if (CMCAssign == null) { return(NotFound()); } ViewData["ChargerID"] = new SelectList(_context.Charger, "ID", "ID"); ViewData["CustomerID"] = new SelectList(_context.Customers, "ID", "ID"); ViewData["MeterID"] = new SelectList(_context.Meter, "ID", "ID"); return(Page()); }