public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var badanieDb = await _context.Badanie.SingleOrDefaultAsync(m => m.Id == id);

            Badanie = CreateFrom(badanieDb);

            if (Badanie != null)
            {
                _context.Badanie.Remove(badanieDb);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var badanieDb = await _context.Badanie
                            .Include(b => b.FirmaBadanie.Firma)
                            .Include(b => b.TypBadania)
                            .Include(b => b.Badany)
                            .SingleOrDefaultAsync(m => m.Id == id);


            Badanie = CreateFrom(badanieDb);

            if (Badanie == null)
            {
                return(NotFound());
            }
            return(Page());
        }