public async Task <IActionResult> DeleteConfirmed(int id)
        {
            //Find the related order detail in the database
            ReorderDetail DbReorderDetail = _context.ReorderDetails
                                            .Include(r => r.Book)
                                            .Include(r => r.Reorder)
                                            .FirstOrDefault(r => r.ReorderDetailID == id);
            var reorderDetail = await _context.ReorderDetails.FindAsync(id);

            _context.ReorderDetails.Remove(reorderDetail);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Details", "Reorders", new { id = DbReorderDetail.Reorder.ReorderID }));
        }
        public IActionResult Edit(ReorderDetail reorderDetail)
        {
            //Find the related reorder detail in the database
            ReorderDetail DbReorderDetail = _context.ReorderDetails
                                            .Include(r => r.Book)
                                            .Include(r => r.Reorder)
                                            .FirstOrDefault(r => r.ReorderDetailID ==
                                                            reorderDetail.ReorderDetailID);

            //update the related fields
            DbReorderDetail.ReorderQuantity = reorderDetail.ReorderQuantity;
            DbReorderDetail.Cost            = DbReorderDetail.Book.Cost;

            //update the database
            if (ModelState.IsValid)
            {
                _context.ReorderDetails.Update(DbReorderDetail);
                _context.SaveChanges();
                return(RedirectToAction("Details", "Reorders", new { id = DbReorderDetail.Reorder.ReorderID }));
            }

            return(View(reorderDetail));
        }