Пример #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Autobus = await _context.Autobuss.FirstOrDefaultAsync(m => m.Id == id);

            if (Autobus == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Пример #2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Autobus = await _context.Autobuss.FindAsync(id);

            if (Autobus != null)
            {
                _context.Autobuss.Remove(Autobus);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }