public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Kitap = await _context.Kitap .Include(k => k.Dil) .Include(k => k.KapakTipi) .Include(k => k.Kategori) .Include(k => k.KitapTuru) .Include(k => k.Yayinevi).FirstOrDefaultAsync(m => m.ID == id); if (Kitap == null) { return(NotFound()); } ViewData["DilID"] = new SelectList(_context.Dil, "ID", "Isim"); ViewData["KapakTipiID"] = new SelectList(_context.KapakTipi, "ID", "Isim"); ViewData["KategoriID"] = new SelectList(_context.Kategori, "ID", "Isim"); ViewData["KitapTuruID"] = new SelectList(_context.KitapTuru, "ID", "Isim"); ViewData["YayineviID"] = new SelectList(_context.Yayinevi, "ID", "Isim"); return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Kitap = await _context.Kitap.FindAsync(id); if (Kitap != null) { _context.Kitap.Remove(Kitap); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Kitap = await _context.Kitap .Include(k => k.Dil) .Include(k => k.KapakTipi) .Include(k => k.Kategori) .Include(k => k.KitapTuru) .Include(k => k.Yayinevi).FirstOrDefaultAsync(m => m.ID == id); if (Kitap == null) { return(NotFound()); } return(Page()); }