public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } TblMain = await _context.TblMain.FindAsync(id); if (TblMain != null) { _context.TblMain.Remove(TblMain); await _context.SaveChangesAsync(); } return(RedirectToPage("/List")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } TblMain = await _context.TblMain .Include(t => t.ListLocation) .Include(t => t.ListStatus) .Include(t => t.ListToolType) .Include(t => t.ListTools).FirstOrDefaultAsync(m => m.ItemId == id); if (TblMain == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } TblMain = await _context.TblMain .Include(t => t.ListLocation) .Include(t => t.ListStatus) .Include(t => t.ListToolType) .Include(t => t.ListTools).FirstOrDefaultAsync(m => m.ItemId == id); if (TblMain == null) { return(NotFound()); } ViewData["GeoLocation"] = new SelectList(_context.ListLocation, "LocationID", "LocationName"); ViewData["StatusID"] = new SelectList(_context.ListStatus, "StatusID", "Status"); ViewData["ItemType"] = new SelectList(_context.ListToolType, "TypeId", "ToolType"); ViewData["ToolName"] = new SelectList(_context.ListTools, "ToolId", "ToolName"); return(Page()); }