// GET: Bons/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var bon = await _context.Bon.FindAsync(id);

            var kun       = new KundeRepository(_context);
            var bonDetail = new BonDetail()
            {
                Kundes  = kun.GetKundeSelectList(),
                Art     = bon.Art,
                Datum   = bon.Datum,
                ID      = bon.ID,
                KundeID = bon.Kunde.ID
            };
            int idd = bon.Kunde.ID;

            if (bon == null)
            {
                return(NotFound());
            }
            return(View(bonDetail));
        }
        // GET: Bons/Create
        public IActionResult Create()
        {
            var bonDet = new BonDetail();
            var kn     = new KundeRepository(_context);

            bonDet.Kundes = kn.GetKundeSelectList();
            return(View(bonDet));
        }
        // GET: Bons/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }


            //var bon = await _context.Bon.FindAsync(id);
            //var kun = new KundeRepository(_context);
            //var bonDetail = new BonDetail()
            //{
            //    Kundes = kun.GetKundeSelectList(),
            //    Art = bon.Art,
            //    Datum = bon.Datum,
            //    ID = bon.ID,
            //    KundeID = bon.Kunde.ID
            //};

            var bon = await _context.Bon.FindAsync(id);

            var kun       = new KundeRepository(_context);
            var bonDetail = new BonDetail()
            {
                Kundes  = kun.GetKundeSelectList(),
                Art     = bon.Art,
                Datum   = bon.Datum,
                ID      = bon.ID,
                KundeID = bon.Kunde.ID
            };

            // int idd = bon.Kunde.ID;
            BonRepository pr = new BonRepository(_context);

            bonDetail.KundeTitel = pr.GetKundeTitel(bon.Kunde.ID);
            if (bon == null)
            {
                return(NotFound());
            }

            return(View(bonDetail));
        }